Jump to content

Qt Documentation Rules: Difference between revisions

From Qt Wiki
No edit summary
Line 1: Line 1:
= Qt Documentation Style Rules Quick Reference =
'''Work in Progress''': The rules are based off official sources in QUIPs and writing guides. However, the rule set is changing and is from the rules merged in qtqa.git


'''Note:''' This page is '''WORK IN PROGRESS''', to test whether we can harmonize our guidelines. This is not official but it is based on the various Qt guidelines.  
This page is the reference for the Qt documentation rules. Each rule has a stable ID, so a reviewer, a linter message, or a patch comment can cite it, and you can look it up here.


This page provides a consolidated reference of language and style rules for Qt documentation, with citations to their authoritative sources. Use this as a checklist when writing or reviewing Qt documentation.
If you are new to Qt documentation, read the [[Qt Writing Guidelines]] first. Then use this page when a review comment or a tool message names an ID such as R12 or G34. The numbering is provisional until the Documentation Team approves it, and existing documentation may not comply with every rule.


'''Note:''' These rules are '''prescriptive''' for new and updated documentation. Existing Qt documentation may not fully comply with all rules.
The rules are prescriptive for new and updated documentation. The table lists the four kinds of ID and what each one means.
 
{| class="wikitable"
! Prefix !! Meaning !! Example
|-
| S || A source that defines a standard || S2 is QUIP 25
|-
| C || A content type: the kind of page or text || C6 is an overview page
|-
| R || A rule that a deterministic tool checks using a regular expression || R12 is sentence-case titles
|-
| G || A rule that needs a person's judgment || G34 is paragraph structure
|}
 
Most R rules are checked by '''Vale''', a linter that reads text and reports places that break a rule, or by '''QDoc''', the Qt tool that turns documentation comments and <code>.qdoc</code> files into HTML. A rule can also be checked by a short script. The dotted names in the Check columns, such as <code>Qt.Language.OxfordComma</code>, are Vale rule names. To run Vale, see [[Setting Up Vale]].
 
If you write a new page, start with these rules: R14 and R15 for the brief, R12 for titles, and G31 and G34 for titles and paragraphs. A '''QUIP''' is a Qt Project proposal document, and S2 is the one about documentation style. An '''imperative''' sentence is a command, as in "Run the application", and an '''indicative''' sentence states a fact, as in "The item ignores events". The "Formerly" notes help readers of old review comments, and you can skip them on a first read. The Sources section is a reference list, and you can skip it on a first read as well.
 
QDoc commands start with a backslash. The table lists the commands that appear most often in the rules and what each one does.
 
{| class="wikitable"
! Command !! What it does
|-
| <code>\brief</code> || Sets the one-sentence summary of a page or type
|-
| <code>\section1</code> || Starts a top-level section of a page
|-
| <code>\l</code> || Links to a page or an API item
|-
| <code>\sa</code> || Adds a "see also" list of links
|-
| <code>\uicontrol</code> || Marks text that appears in a user interface
|-
| <code>\externalpage</code> || Declares a page outside the documentation as a link target
|}
 
__TOC__


== Sources ==
== Sources ==
 
The following sources define Qt documentation standards. When sources conflict, follow the hierarchy: S1, then S2, then S3 and S4, then S9. The QDoc Manual (S10) is authoritative for syntax only, not for style.
The following official sources define Qt documentation standards. When sources conflict, follow the hierarchy: S1 → S2 → S3/S4 → S9.


{| class="wikitable"
{| class="wikitable"
Line 30: Line 65:
| S8 || QDoc Style Guidelines || https://wiki.qt.io/QDoc_Style_Guidelines || QDoc command formatting and alt text rules
| S8 || QDoc Style Guidelines || https://wiki.qt.io/QDoc_Style_Guidelines || QDoc command formatting and alt text rules
|-
|-
| S9 || Microsoft Writing Style Guide || https://learn.microsoft.com/en-us/style-guide/welcome/ || Supplementary reference when Qt sources don't specify
| S9 || Microsoft Writing Style Guide || https://learn.microsoft.com/en-us/style-guide/welcome/ || Supplementary reference when Qt sources do not specify
|-
|-
| S10 || QDoc Manual || https://doc.qt.io/qt-6/qdoc-index.html || QDoc command syntax (not a style authority)
| S10 || QDoc Manual || https://doc.qt.io/qt-6/qdoc-index.html || QDoc command syntax (not a style authority)
|}
|}


== API Documentation Requirements ==
For API documentation, the C++ and QML style pages define the requirements for classes, functions, properties, and signals:
 
* '''C++ APIs:''' See [[C++ Documentation Style]]
* '''QML APIs:''' See [[QML Documentation Style]]
* '''Examples:''' See [[Writing Example Documentation and Tutorials]] for the 11 mandatory elements
 
== Content types ==
A '''content type''' is the kind of page or text that you write. The [[Qt Writing Guidelines#Choosing the content type|Writing Guidelines]] explain how to choose one in plain words, such as class reference, tutorial, or overview. Detect the type first, and then apply only the rules for that type, because a rule such as "use you" fits a tutorial and does not fit an API brief. A '''brief''' is the one-sentence summary at the top of a QDoc block, set with the <code>\brief</code> command. A '''topic command''' is the command that opens a documentation block for one thing, such as <code>\class</code>, <code>\qmltype</code>, or <code>\page</code>.
 
The table lists each content type, how to detect it, and its writing register. Detection by topic command is exact. Detection by page name is a heuristic, and a page that fits no type is treated as C6.
 
{| class="wikitable"
! ID !! Type !! Detect by !! Register
|-
| C1 || C++ API reference || <code>\class</code>, <code>\fn</code>, <code>\property</code>, <code>\enum</code>, <code>\macro</code>, <code>\typedef</code>, <code>\namespace</code> || G23
|-
| C2 || QML API reference || <code>\qmltype</code>, <code>\qmlproperty</code>, <code>\qmlmethod</code>, <code>\qmlsignal</code>, <code>\qmlvaluetype</code> || G23
|-
| C3 || Module page || <code>\module</code>, <code>\qmlmodule</code>, <code>\page *-index.html</code> || G25
|-
| C4 || Example || <code>\example</code>; example group: <code>\group *_examples</code> || G25 or G24
|-
| C5 || Tutorial and getting started || <code>\page</code> name matches <code>tutorial</code>, <code>getting-started</code>, or <code>first</code> (heuristic) || G24
|-
| C6 || Overview and concept page || Any other <code>\page</code> (fallback) || G25
|-
| C7 || Platform and deployment || <code>\page</code> name matches a platform (<code>android</code>, <code>ios</code>, <code>wasm</code>, <code>windows</code>, <code>macos</code>, <code>linux</code>, <code>embedded</code>) or <code>deploy</code> (heuristic) || G24
|-
| C8 || Porting, changes, and what's new || <code>\page</code> name matches <code>porting</code>, <code>changes</code>, <code>whatsnew</code>, or <code>new-in</code> (heuristic) || G29, G24, or G25
|-
| C9 || Qt Creator and Qt Design Studio documentation || Qt Creator and Qt Design Studio sources || G24 or G23
|-
| C10 || External page declaration || <code>\externalpage</code> || None
|-
| C11 || Legal and license text || License headers, <code>\legalese</code>, third-party notices || G28
|-
| C12 || Qt Framework development tools || <code>\page</code> under a tools documentation directory, or named <code>qtqml-tooling-*</code> (heuristic) || G23 or G24
|-
| C16 || Commit message || The commit message of a change, not a QDoc topic || G25, and G29 for a <code>[ChangeLog]</code> entry
|-
| C17 || Report and proposal || A report, proposal, or summary document, not a QDoc topic || G25
|}
 
C13, C14, and C15 are reserved IDs for the Qt Blog post, the qt.io product page, and the Qt Forum post. No rule uses them yet, and the gap is not an error.


Requirements for documenting C++ and QML APIs are defined in the official style guides:
== Registers ==
A '''register''' is the way a type of text sounds: its person, tense, mood, and sentence length. A reference entry and a tutorial step follow different registers, so the same sentence can be right in one and wrong in the other. Each content type expects one register.


* '''C++ APIs:''' See [[C++ Documentation Style]] for class, function, property, and signal documentation requirements
When the Microsoft Writing Style Guide (S9) and a register disagree, the register wins. Rules G1 to G22 still apply inside every register.
* '''QML APIs:''' See [[QML Documentation Style]] for QML type, property, method, and signal documentation requirements
* '''Examples:''' See [[Writing Example Documentation and Tutorials]] for the 11 mandatory elements


'''Key points:'''
=== G23: Reference register ===
* Classes and QML types require <code>\brief</code>, <code>\since</code>, and <code>\inmodule</code>/<code>\inqmlmodule</code>
Used for C1 and C2, and for reference pages of C9 and C12. The text lets the reader look up one fact fast: third person, present tense, indicative, one fact per sentence. It does not teach and it has no steps. It uses "you" only in usage notes about the reader's own code.
* Properties require <code>\brief</code>
* Functions and methods should start with an action verb ("Returns...", "Sets...")


== Core Principles (R1-R10) ==
{| class="wikitable"
! Incorrect !! Correct
|-
| Now let's add a few items and watch the list grow. || Appends <code>\a value</code> to the list.
|}


These fundamental writing principles apply to all Qt documentation. They ensure clarity, consistency, and accessibility for an international audience. Derived primarily from [[QUIP 25]] (S2), [[Qt Writing Guidelines]] (S1), and [[Microsoft Writing Style Guide]] (S9).
=== G24: Tutorial register ===
Used for C5 and C7, and for C4 walkthroughs, C8 porting steps, and C9 and C12 usage pages. The text walks the reader through steps in order, with "you" and imperative sentences. State the result instead of giving reassurance.


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Incorrect !! Correct
|-
|-
| '''R1''' || '''Use active voice''' || QUIP 25, Qt Writing Guidelines, MS Style Guide || Passive acceptable when actor unknown. "The item ignores events" not "Events are ignored by the item"
| Don't worry, you should see a window appear. || Run the application. A window opens.
|}
 
=== G25: Conceptual register ===
Used for C3, C6, C16, and C17, and for C4 descriptions and C7 and C8 explanations. The text builds a mental model: what something is, why it exists, and when to use it. It uses third person, or "you" when the reader makes a choice, in present tense. Each paragraph opens with a plain topic sentence, sections go from what, to why, to how, and the text uses at most one analogy. It does not list API facts or give steps. It links to the reference page or the tutorial instead.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R2''' || '''Be clear and concise''' || QUIP 25, MS Style Guide || Aim for ≤20 words per sentence. "To" not "In order to"
| The <code>connect()</code> function takes five parameters. || Signals and slots let objects communicate without knowing which objects receive the signal.
|}
 
=== G26: Essay register ===
Used for persuasive writing, such as a blog post or a design rationale, and not for pages on doc.qt.io. It uses contrasts, aphorisms, rhetorical questions, and one-sentence paragraphs for punch. A "why" section in an overview page may hold at most one contrast and no aphorisms. In C1 to C5, C7 to C9, and C12 it is a finding.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R3''' || '''Use correct terminology''' || QUIP 25, Qt Writing Guidelines, Qt Terms and Concepts || Use "widget" not "control", "type" not "component", "developer" not "programmer"
| The copy is not an inconvenience; it is the whole point. || A queued connection copies its arguments because the slot runs later, on another thread.
|}
 
=== G27: Marketing register ===
Used for product pages and launch posts. It leads with benefits and uses superlatives, exclamations, and fragments. A module page or a what's-new page may hold one or two introductory sentences that state facts. In API reference, examples, tutorials, and overviews it is a finding.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R4''' || '''Use present tense''' || QUIP 25, Qt Writing Guidelines, MS Style Guide || "Returns true" not "Will return true"
| Build stunning apps faster than ever, with one codebase for every screen. || Qt Quick applications run on desktop, mobile, and embedded platforms.
|}
 
=== G28: Legal register ===
Used for C11. It defines obligations, so "shall" and "must" are allowed. Review Qt-authored <code>\legalese</code> notices only, and never rewrite third-party license text.
 
=== G29: Release notes register ===
Used for change lists in C8. It records what changed, in past tense, starting with the verb, with one change per item. Planned removals, such as "will be removed in Qt 7", keep the future tense.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R5''' || '''Use imperative mood for instructions''' || MS Style Guide, C++ Doc Style, QML Doc Style || Briefs: "Returns the value." Descriptions: "This property holds..."
| We've gone ahead and removed the old API. || Removed <code>QFoo::oldValue()</code>. Use <code>QFoo::value()</code> instead.
|}
 
=== G30: Conversational register ===
Used for forum posts, chat, and code review comments. It allows filler, loose grammar, and the first person singular. In pages of C1 to C9 and C12 it is a finding, apart from common contractions and a rare "we recommend" when no other wording works. A sentence-initial "So" that acts as filler is a finding in new text.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R6''' || '''Use "you" for user instructions''' || QUIP 25, Qt Writing Guidelines, MS Style Guide || In guides/tutorials and tools docs. API patterns typically don't require "you".
| So, to use the model, set it on the view. || To use the model, set it on the view.
|}
 
== Tool-checkable rules ==
A tool checks each rule in this section. The check is a Vale rule, a QDoc warning message, a pattern search, or a short script, and the table of each group names it. A page passes a rule when its check reports nothing.
 
The 36 rules keep the IDs that this page used before. They are grouped by topic: language, grammar, API markup, links, examples and images, and QDoc formatting. Rules that need judgment, such as active voice, are in the next section.
 
=== Language ===
These rules keep wording concise and consistent. The table lists each rule and its check.
 
{| class="wikitable"
! Rule !! Summary !! Check !! Notes
|-
|-
| '''R7''' || '''Avoid jargon and Latin terms''' || QUIP 25, Qt Writing Guidelines, MS Style Guide || "for example" not "e.g.", "that is" not "i.e.", "through" not "via"
| '''R2''' || '''Be clear and concise''' || Vale <code>Qt.Language.WordyConstructions</code>, <code>Qt.Language.WordyFillers</code>, <code>Qt.Language.WordyQuantifier</code> || Drop filler. "To" not "In order to"
|-
|-
| '''R8''' || '''Be consistent''' || MS Style Guide || Same word for same concept throughout
| '''R3''' || '''Use correct terminology''' || Vale <code>Qt.Language.QtTerminology</code> || Product and module names are spelled exactly. Use "widget" not "control", "type" not "component", "developer" not "programmer". See [[#Substitutions and terminology|Substitutions and terminology]]
|-
|-
| '''R9''' || '''Use parallel structure''' || MS Style Guide || List items use same grammatical form
| '''R4''' || '''Use present tense''' || Vale <code>Qt.Language.FutureTense</code> || "Returns true" not "Will return true". Planned removals, such as "will be removed in Qt 7", are exempt
|-
|-
| '''R10''' || '''Avoid ambiguous pronouns''' || QUIP 25, MS Style Guide || Repeat noun when "it" or "this" is unclear
| '''R7''' || '''Avoid jargon and idioms''' || Vale <code>Qt.Language.Idioms</code> || An idiom is hard to translate and is replaced with a plain word
|-
| '''R38''' || '''Use the substitutions''' || Vale <code>Qt.Language.HedgingWords</code>, <code>Qt.Language.LatinTerms</code>, <code>Qt.Language.LoseLoose</code>; pattern search for the verb "land" || Hedging words, Latin terms, "lose" and "loose", and the verb "land". Write the verb you mean: "merge" for a change, "is included in" for a release, "ends up in" for a result. "Landing page" passes
|}
|}


=== Examples ===
The examples show each rule with an incorrect and a correct form.


{| class="wikitable"
{| class="wikitable"
! Rule !! ❌ Incorrect !! ✅ Correct
! Rule !! Incorrect !! Correct
|-
|-
| R1 || Events are ignored by the item when disabled. || The item ignores events when disabled.
| R2 || In order to enable the feature, you need to set the property. || Set the property to enable the feature.
|-
|-
| R2 || In order to enable the feature, you need to set the property. || Set the property to enable the feature.
| R2 || This is kind of complex and needs a lot of setup. || This is complex and needs several setup steps.
|-
|-
| R3 || The programmer can use any control. || The developer can use any widget.
| R3 || The programmer can use any control. || The developer can use any widget.
|-
| R3 || Qt5 and QtQuick support this. || Qt 5 and Qt Quick support this.
|-
|-
| R4 || The function will return true if successful. || The function returns true if successful.
| R4 || The function will return true if successful. || The function returns true if successful.
|-
|-
| R5 || The value is returned by this function. || Returns the value.
| R7 || The cache works under the hood. || The cache works automatically.
|-
|-
| R6 (guides) || One can configure the settings in the dialog. || You can configure the settings in the dialog.
| R38 || Simply configure it via the settings, e.g. the kit. || Configure it through the settings, for example the kit.
|-
|-
| R6 (API) || You must call this function to update. || Call this function to update the view.
| R38 || The fix landed in 6.5. || The fix is included in 6.5.
|}
 
=== Grammar ===
These rules cover punctuation and capitalization.
 
{| class="wikitable"
! Rule !! Summary !! Check !! Notes
|-
|-
| R7 || Use QML types, e.g., Rectangle, via the import statement. || Use QML types, such as Rectangle, through the import statement.
| '''R11''' || '''Use a serial (Oxford) comma''' || Vale <code>Qt.Language.OxfordComma</code> || "name, value, and type" not "name, value and type"
|-
|-
| R9 || Set the property; Calling the function; You should verify || Set the property; Call the function; Verify the result
| '''R12''' || '''Use sentence case for titles''' || A script that classifies each title; Vale <code>Microsoft.Headings</code> checks one title at a time || "Getting started with Qt Quick" not "Getting Started With Qt Quick". A page may use title case instead, but only when every title on the page does. The script reports the titles that differ from the form of the page. Table header cells always use sentence case
|-
|-
| R10 || The widget and the parent both update. It receives the event first. || The widget and the parent both update. The widget receives the event first.
| '''R68''' || '''No em dash as a connector''' || Vale <code>Microsoft.Dashes</code>; pattern search for the em dash character || Choose the punctuation that names the relationship. See G22
|}
|}
== Grammar Rules (R11-R13) ==
These grammar rules ensure consistency in punctuation, capitalization, and number formatting across all Qt documentation. Based on [[QUIP 25]] (S2), [[Qt Writing Guidelines]] (S1), and [[Microsoft Writing Style Guide]] (S9).


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Rule !! Incorrect !! Correct
|-
|-
| '''R11''' || '''Use serial (Oxford) comma''' || QUIP 25, Qt Writing Guidelines || "name, value, and type" not "name, value and type"
| R11 || name, value and type || name, value, and type
|-
|-
| '''R12''' || '''Use sentence-case for titles''' || Qt Writing Guidelines, QUIP 25, MS Style Guide || "Getting started with Qt Quick" not "Getting Started With Qt Quick"
| R12 || A page with the titles "Getting started", "Building your first application", and "Running The Example" || The same page with "Running the example"
|-
|-
| '''R13''' || '''Numbers: spell out 1-9''' || QUIP 25 || Numerals for 10+, dimensions, versions, code values
| R12 || Getting Started With Qt Quick || Getting started with Qt Quick
|-
| R68 || <code>The model -- which is shared -- updates the view.</code> (written with a long dash in place of the two hyphens) || The model, which is shared, updates the view.
|}
|}


== API Documentation (R14-R19) ==
=== API markup ===
 
These rules cover the QDoc commands that every documented API and module page needs. A '''top-level node''' is the start of a documentation block, such as <code>\class</code>, <code>\qmltype</code>, <code>\page</code>, or <code>\example</code>.
These rules define the required patterns for documenting C++ and QML APIs. They ensure consistency in how classes, functions, properties, and signals are documented. Based on [[C++ Documentation Style]] (S3), [[QML Documentation Style]] (S4), and [[QDoc Manual]] (S10).


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Rule !! Summary !! Check !! Notes
|-
|-
| '''R14''' || '''\brief scope''' || C++ Doc Style, QML Doc Style, QDoc Manual || '''MANDATORY''' for: \class, \qmltype, \property, \qmlproperty, \example, \page. '''Recommended''' for: \fn, \qmlmethod, \qmlsignal, \enum
| '''R14''' || '''<code>\brief</code> on top-level nodes''' || Script: a block that opens with a top-level command has no <code>\brief</code> || '''Required''' for <code>\class</code>, <code>\struct</code>, <code>\union</code>, <code>\namespace</code>, <code>\headerfile</code>, <code>\qmltype</code>, <code>\qmlvaluetype</code>, <code>\page</code>, <code>\example</code>, <code>\module</code>, <code>\qmlmodule</code>, and <code>\group</code>. Member nodes such as <code>\fn</code>, <code>\enum</code>, and <code>\qmlproperty</code> need none. QDoc has no warning for a missing brief. QDoc uses the brief in lists of types, in index files, and in the page description
|-
|-
| '''R15''' || '''Briefs end with period''' || C++ Doc Style, QML Doc Style || Applies to all briefs that are provided
| '''R15''' || '''Briefs end with a period''' || Vale <code>Qt.Structure.QDocBrief</code>; QDoc message <code>'\brief' statement does not end with a full stop</code> || Applies to every brief that is provided
|-
|-
| '''R16''' || '''Class/Type documentation''' || C++ Doc Style, QML Doc Style, QDoc Manual || Requires: \class/\qmltype, \brief, \inmodule/\inqmlmodule, \since
| '''R16''' || '''A class has <code>\inmodule</code>''' || QDoc message <code>has no \inmodule command</code> || A class needs <code>\class</code>, <code>\brief</code>, <code>\inmodule</code>, and <code>\since</code>. The <code>\since</code> version comes from the version control history of the file
|-
|-
| '''R17''' || '''Function brief patterns''' || C++ Doc Style, QML Doc Style || Start with verb: "Returns...", "Sets...", "Constructs...". Brief recommended, not mandatory.
| '''R51''' || '''Generic QML types''' || Vale <code>Qt.Structure.QMLGenericTypes</code> || Use <code>object</code>, not a C++ pointer type, in QML method signatures
|-
|-
| '''R18''' || '''Property brief patterns''' || C++ Doc Style, QML Doc Style || "This property holds...". Brief is '''mandatory''' for properties.
| '''R58''' || '''Module landing page''' || Vale <code>Qt.Structure.ModuleExamplesSection</code>, <code>Qt.Structure.ModuleReferenceSection</code> || A module page has an Examples section and a Reference section
|-
|-
| '''R19''' || '''Signal brief patterns''' || C++ Doc Style, QML Doc Style || "This signal is emitted when...". Brief recommended, not mandatory.
| '''R59''' || '''Example group''' || Vale <code>Qt.Structure.ExampleGroupIngroup</code> || A group of examples has <code>\ingroup all-examples</code>
|-
| '''R62''' || '''Module review checklist''' || A combination of R58, R59, R61, and R15 on the landing page || One report line per item, each with its tool output
|}
|}
=== API Brief Pattern Examples ===


{| class="wikitable"
{| class="wikitable"
! Type !! Pattern !! Example
! Rule !! Incorrect !! Correct
|-
|-
| Class || The [Class] class provides/is... || \brief The QWidget class is the base class of all user interface objects.
| R14 || <code>/*! \class QFoo \inmodule QtCore */</code> || <code>/*! \class QFoo \inmodule QtCore \brief The QFoo class stores a range. */</code>
|-
|-
| Function (accessor) || Returns... || \brief Returns the current value of the property.
| R15 || <code>\brief Returns the width</code> || <code>\brief Returns the width.</code>
|-
|-
| Function (mutator) || Sets... || \brief Sets the widget's geometry to the specified rectangle.
| R16 || <code>/*! \class QFoo \brief ... */</code> || <code>/*! \class QFoo \inmodule QtCore \brief ... */</code>
|-
|-
| Function (constructor) || Constructs... || \brief Constructs a widget with the given parent.
| R51 || <code>\qmlmethod QObject* Instantiator::objectAt(int index)</code> || <code>\qmlmethod object Instantiator::objectAt(int index)</code>
|-
|-
| Property || This property holds... || \brief This property holds whether the widget is enabled.
| R58 || <code>\page qtfoo-index.html</code> and <code>\title Qt Foo</code> with no Examples or Reference section || The same page with <code>\section1 Examples</code> and <code>\section1 Reference</code>
|-
|-
| Signal || This signal is emitted when... || \brief This signal is emitted when the button is clicked.
| R59 || <code>\group qtfoo_examples</code> and <code>\title Qt Foo Examples</code> || The same group with <code>\ingroup all-examples</code>
|}
|}


=== Class Documentation Template ===
The brief patterns of the individual API entries are judgment rules, and they are in G9 and G10. This template shows a class block with the required commands. It is a comment in a C++ source file:


<pre>
<pre>
Line 167: Line 305:
</pre>
</pre>


== Example Documentation (R20-R23) ==
=== Links ===
These rules cover how a link is written. Links connect documentation pages. For the diagnosis of a broken link, see the [https://doc.qt.io/qt-6/qdoc-index.html QDoc Manual]. R45, R48, R49, R50, and R60 share one check: QDoc reports <code>Can't link to '&lt;target&gt;'</code>.


These rules define the required elements and quality standards for Qt example documentation. Every example must meet these requirements before being included in Qt releases. Based on [[Writing Example Documentation and Tutorials]] (S6) and [[Qt Examples Guidelines]] (S5).
{| class="wikitable"
! Rule !! Summary !! Check !! Notes
|-
| '''R45''' || '''Basic link syntax''' || QDoc message || <code>\l{target}</code>, <code>\l{target}{text}</code>, <code>\l[QML]{target}</code>
|-
| '''R47''' || '''Section links within type documentation''' || Vale <code>Qt.Structure.SectionLinkAntiPattern</code> || Use <code>TypeName#Section Title</code>, not <code>page.html#anchor</code>. The <code>page.html#anchor</code> form works only for explicit <code>\page</code> pages, not for generated type pages
|-
| '''R48''' || '''External page links''' || QDoc message || The <code>\externalpage</code> title and the link target match exactly
|-
| '''R49''' || '''QML cross-module links''' || QDoc message || Use the <code>::</code> separator: <code>{QtQuick.Controls::ToolTip}</code>
|-
| '''R50''' || '''QML value type case''' || QDoc message || Value types use camelCase: <code>geoCoordinate</code>, not <code>GeoCoordinate</code>. Object types use PascalCase
|-
| '''R60''' || '''Cross-module linking''' || QDoc message || A link into another module needs that module in the dependencies of the <code>.qdocconf</code> file, the configuration file of the documentation build
|-
| '''R61''' || '''Configuration dependencies''' || QDoc message; a pattern search of <code>depends +=</code> lines || The <code>.qdocconf</code> file lists every linked module
|}


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Rule !! Incorrect !! Correct
|-
| R45 || <code>\l QWidget{the widget}</code> || <code>\l{QWidget}{the widget}</code>
|-
|-
| '''R20''' || '''11 mandatory elements''' || Writing Example Documentation || Title, \example, \brief, \examplecategory, image, overview, running instructions, platform notes, main content, references, licenses
| R47 || <code>\l{qcolor.html#the-hsv-color-model}</code> || <code>\l{QColor#The HSV Color Model}</code>
|-
|-
| '''R21''' || '''Zero warnings''' || Qt Examples Guidelines || C++ compiler and qmllint must produce no warnings
| R48 || <code>\l{Qt Wiki Writing Guidelines}</code> when the title is "Qt Writing Guidelines" || <code>\l{Qt Writing Guidelines}</code>
|-
|-
| '''R22''' || '''Screenshot specs''' || Qt Examples Guidelines || Minimum 440×320 pixels, icons 64×64, high DPI, WebP format
| R49 || <code>\l QtQuick.Controls.ToolTip.delay</code> || <code>\l{QtQuick.Controls::ToolTip::delay}</code>
|-
|-
| '''R23''' || '''Title guidelines''' || Qt Examples Guidelines, Writing Example Documentation || Don't repeat "Example" or module name in title
| R50 || <code>\l{GeoCoordinate::latitude}</code> || <code>\l{geoCoordinate::latitude}</code>
|-
| R60 || <code>\l{QNetworkReply}</code> from a module whose configuration lacks <code>qtnetwork</code> || The same link, with <code>depends += qtnetwork</code>
|-
| R61 || Links to QtNetwork types and <code>depends += qtcore</code> || <code>depends += qtcore qtnetwork</code>
|}
|}


== Alt Text (R24-R27) ==
=== Examples and images ===
These rules cover example documentation and images. They keep examples complete and keep images accessible to readers who use a screen reader. '''Alt text''' is the text that describes an image for a screen reader and appears when the image fails to load.


These rules ensure images in Qt documentation are accessible to users with visual impairments. Alt text describes images for screen readers and appears when images fail to load. Based on [[QDoc Style Guidelines]] (S8) and QUIP 21.
{| class="wikitable"
! Rule !! Summary !! Check !! Notes
|-
| '''R20''' || '''11 mandatory elements''' || Script on the file that holds <code>\example</code> || Title, <code>\example</code>, <code>\brief</code>, <code>\examplecategory</code>, image, overview, running instructions, platform notes, main content, references, licenses
|-
| '''R21''' || '''Zero warnings''' || Pattern search of the build log for <code>warning:</code>; <code>qmllint</code> exits with 0 || The C++ compiler and <code>qmllint</code> must produce no warnings
|-
| '''R22''' || '''Screenshot size''' || Image size check || At least 440 by 320 pixels for high-DPI screenshots, and icons at least 64 by 64. WebP is the preferred format
|-
| '''R23''' || '''Example titles''' || Vale <code>Qt.Structure.ExampleTitleRepetition</code> || Do not repeat "Example" or the module name in the title
|-
| '''R24''' || '''Alt text format''' || Vale <code>Qt.Structure.AltTextFormat</code> || Capital first letter and no final period: <code>{Window with toolbar and buttons}</code>
|-
| '''R26''' || '''Alt text terms''' || Vale <code>Qt.Structure.AltTextClassNames</code> || Use generic lowercase UI terms: "button", not "Button" or "PushButton"
|}


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Rule !! Incorrect !! Correct
|-
| R20 || <code>\example gauge</code> and <code>\title Gauge</code>, with no <code>\brief</code> and no <code>\examplecategory</code> || The same page with <code>\brief Shows a gauge.</code>, <code>\examplecategory {User Interface Components}</code>, and <code>\image gauge.webp {Gauge at 40 percent}</code>
|-
| R21 || <code>main.cpp:12: warning: unused variable 'w'</code> || A build log with no <code>warning:</code> lines
|-
|-
| '''R24''' || '''Format: capital letter, no period''' || QDoc Style Guidelines, QUIP 21 || {Window with toolbar and buttons}
| R22 || An image of 320 by 240 pixels || An image of 880 by 640 pixels
|-
|-
| '''R25''' || '''Priority order''' || QDoc Style Guidelines || 1. Visible text/labels 2. Context/purpose 3. Visual description
| R23 || <code>\title Qt Quick Example: Button Example</code> || <code>\title Button</code>
|-
|-
| '''R26''' || '''Use generic UI terms''' || QDoc Style Guidelines || "button" not "Button", "dialog" not "Dialog"
| R24 || <code>\image toolbar.png {toolbar with dark mode toggle.}</code> || <code>\image toolbar.png {Toolbar with dark mode toggle}</code>
|-
|-
| '''R27''' || '''Use descriptive phrases''' || QDoc Style Guidelines || Noun phrases, not full sentences
| R26 || <code>{Dialog with a PushButton and a CheckBox}</code> || <code>{Dialog with a button and a checkbox}</code>
|}
|}


=== Alt Text Examples by Content Type ===
The <code>\image</code> command goes in a <code>.qdoc</code> file or a documentation comment. An alt text on the same line as <code>\image</code> must fit within 80 columns. If it does not, move it to the next line and indent it to align with the file name:
 
<pre>
// Same line (within 80 columns):
\image qtquickcontrols-button-custom.png {Custom styled button}
 
// Next line (if exceeds 80 columns), indented to align with filename:
\image qtquickcontrols-switch.png
      {Switch control labeled Switch in off state}
</pre>
 
Alt text for different images follows the pattern in the table. The judgment about what to include is G11.


{| class="wikitable"
{| class="wikitable"
! Image Type !! ❌ Incorrect !! ✅ Correct
! Image type !! Incorrect !! Correct
|-
|-
| Screenshot || Screenshot of the main window || {Window with toolbar containing dark mode toggle and buttons}
| Screenshot || Screenshot of the main window || {Window with toolbar containing dark mode toggle and buttons}
Line 214: Line 405:
| Example app || Screenshot of example || {Qt logo with three light types and lighting controls}
| Example app || Screenshot of example || {Qt logo with three light types and lighting controls}
|-
|-
| Chart/diagram || Bar chart showing data || {Sales increased 25% in Q3}
| Chart or diagram || Bar chart showing data || {Sales increased 25% in Q3}
|}
|}


=== Alt Text Priority Order ===
=== QDoc formatting ===
These rules cover command syntax, line length, lists, tables, and keyboard shortcuts. R52 limits a list to between two and seven items.


# '''Option 1 (Recommended):''' Include visible text, labels, or icons from the image
{| class="wikitable"
# '''Option 2:''' Context-focused description (purpose, behavior, state)
! Rule !! Summary !! Check !! Notes
# '''Option 3:''' Generic visual description
|-
| '''R39''' || '''No space before a curly brace''' || Vale <code>Qt.Structure.NoSpaceBeforeBrace</code> || '''Recommended''' for compact text. <code>\l{QWidget}</code> is preferred over <code>\l {QWidget}</code>. Both forms parse the same. Not strictly enforced
|-
| '''R40''' || '''80-column line length''' || Vale <code>Qt.Mechanics.LineLength</code> || '''CI-enforced.''' For documentation comments and <code>.qdoc</code> files. Table rows count
|-
| '''R41''' || '''<code>\sa</code> targets resolve''' || QDoc message <code>Can't link to '</code> || '''Required.''' Each <code>\sa</code> target must resolve to an actual page or member
|-
| '''R43''' || '''Keyboard shortcut formatting''' || Vale <code>Qt.Structure.KeyboardShortcutFormat</code> || <code>Ctrl+B</code>; sequence: <code>Ctrl+K, Ctrl+D</code>; platform: <code>Ctrl+O</code> (<code>Cmd+O</code> on macOS)
|-
| '''R52''' || '''List length''' || Script: counts the <code>\li</code> items between <code>\list</code> and <code>\endlist</code> || A list has two to seven items. A list of one item becomes a sentence
|-
| '''R53''' || '''List punctuation''' || Vale <code>Qt.Structure.ListItemPunctuation</code>, <code>Microsoft.Semicolon</code> || No trailing <code>and</code> or comma at the end of an item
|-
| '''R55''' || '''Empty table cells''' || Vale <code>Qt.Structure.TableEmptyCell</code> || Write "None" in an empty cell. A Notes column is exempt
|-
| '''R56''' || '''Table headers''' || Vale <code>Qt.Structure.TableGenericHeaders</code> || A header names its column: "Property" and "Default value", not "Name" and "Value"
|}


=== Formatting ===
{| class="wikitable"
! Rule !! Incorrect !! Correct
|-
| R39 || <code>See \l {QWidget}.</code> || <code>See \l{QWidget}.</code>
|-
| R40 || A 95-character <code>\li</code> line || The same line wrapped at 80
|-
| R41 || <code>\sa setWidht()</code> || <code>\sa setWidth()</code>
|-
| R43 || Press Control+B or Ctrl + B. || Press <code>Ctrl+B</code> (<code>Cmd+B</code> on macOS).
|-
| R52 || A list with one <code>\li</code> item, "The widget" || The function takes the widget.
|-
| R53 || <code>\li The width, and</code> || <code>\li The width</code>
|-
| R55 || <code>\row \li height \li</code> || <code>\row \li height \li None</code>
|-
| R56 || <code>\header \li Name \li Value</code> || <code>\header \li Property \li Default value</code>
|}


<pre>
== Judgment rules ==
// Same line (within 80 columns):
A person checks each rule in this section, because no tool can decide it reliably. A reviewer cites the ID, and a Vale rule may shortlist candidates. The 23 rules are G1 to G22 without G18, plus G31 and G34. Each entry shows its former wiki ID, when it has one, and one incorrect and one correct example.
\image qtquickcontrols-button-custom.png {Custom styled button}
 
G18 is retired and G32 and G33 are reserved. The page lists them so that a gap in the numbers is not mistaken for an error.
 
=== G1: Active voice ===
Formerly R1. Prefer active voice. Passive voice is fine when the actor is unknown or does not matter.
 
{| class="wikitable"
! Incorrect !! Correct
|-
| Events are ignored by the item when disabled. || The item ignores events when disabled.
|}
 
=== G2: Terminology beyond the list ===
Formerly part of R3. Terms that R3 does not list are checked against Qt Terms and Concepts (S7).
 
{| class="wikitable"
! Incorrect !! Correct
|-
| Add the element to the QML scene tree. || Add the item to the Qt Quick scene.
|}


// Next line (if exceeds 80 columns), indented to align with filename:
=== G3: Imperative mood ===
\image qtquickcontrols-switch.png
Formerly R5 and R37. Briefs and instructions use the imperative mood, and descriptions use the indicative mood. Class and type briefs follow the pattern "The X class provides...". In review comments, write "imperative mood" or "indicative mood", not "neutral voice".
      {Switch control labeled Switch in off state}
</pre>


== Writing Contexts (R28-R29) ==
{| class="wikitable"
! Incorrect !! Correct
|-
| <code>\brief This function is used to set the width.</code> || <code>\brief Sets the width.</code>
|}


Different types of Qt documentation require different writing styles. API reference documentation is formal and technical, while tutorials are conversational and instructional. These rules help you choose the right style for each context. Based on [[C++ Documentation Style]] (S3), [[QML Documentation Style]] (S4), [[Qt Writing Guidelines]] (S1), and [[Writing Example Documentation and Tutorials]] (S6).
=== G4: Addressing the reader ===
Formerly R6. Use "you" when the sentence is about a step or a choice of the reader, or about a requirement on the reader's code. Use third person when the sentence is about what the API or tool does, and for a definition or a property value. Do not replace "you" with "one", "the developer", "the programmer", or "we".


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Incorrect !! Correct
|-
|-
| '''R28''' || '''API documentation style''' || C++ Doc Style, QML Doc Style || Present tense, imperative briefs, indicative descriptions, no "you"
| One can configure the kit in the settings. || You can configure the kit in the settings.
|-
|-
| '''R28b''' || '''Tools documentation style''' || Qt Writing Guidelines || Present tense, "you" acceptable, UI elements in bold, menu paths with >
| In API reference: You can use this function to get the size of the list. || In API reference: Returns the size of the list.
|}
 
=== G5: Consistency ===
Formerly R8, with R34 as an alias. Use one term for one concept on a page.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R29''' || '''User guide/tutorial style''' || Qt Writing Guidelines, Writing Example Documentation || Use "you", explain concepts, less jargon
| Add a delegate to the list view. The ListView then... || Add a delegate to the list view. The list view then...
|}
|}


== Common Mistakes (R30-R37) ==
=== G6: Parallel structure ===
Formerly R9. Items of a list use the same grammatical form.


This quick reference lists the most frequent documentation errors and their corrections. Use this as a checklist when reviewing documentation. Each mistake references the rule that explains the correct approach.
{| class="wikitable"
! Incorrect !! Correct
|-
| Set the model; Calling reset(); You should verify it. || Set the model; Call reset(); Verify the result.
|}
 
=== G7: Ambiguous pronouns ===
Formerly R10, with R33 as an alias. Repeat the noun when "it" or "this" is unclear.


{| class="wikitable"
{| class="wikitable"
! Rule !! Mistake !! Correction !! Cross-ref
! Incorrect !! Correct
|-
|-
| '''R30''' || Passive voice || Use active voice || R1
| The view updates the model. It is refreshed first. || The view updates the model. The model is refreshed first.
|}
 
=== G8: Numbers ===
Formerly R13. Spell out one to nine. Use numerals for 10 and up, for dimensions, versions, and code values.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R31''' || Future tense || Use present tense || R4
| The function takes 3 arguments. || The function takes three arguments.
|}
 
=== G9: Function briefs ===
Formerly R17. A function brief starts with the verb for the operation: "Returns...", "Sets...", "Constructs...". A member node needs no <code>\brief</code> (R14), so a brief is recommended here, not mandatory.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R32''' || Wordy phrases || Be concise || R2
| <code>\brief The width getter.</code> || <code>\brief Returns the width.</code>
|}
 
The patterns below cover the brief of each kind of entry.
 
{| class="wikitable"
! Type !! Pattern !! Example
|-
|-
| '''R33''' || Ambiguous "this" || Be specific || R10
| Class || The [Class] class provides or is... || \brief The QWidget class is the base class of all user interface objects.
|-
|-
| '''R34''' || Inconsistent terms || Pick one term || R8
| Function (accessor) || Returns... || \brief Returns the current value of the property.
|-
|-
| '''R35''' || Missing \brief on class/type/property || Add \brief || R14
| Function (mutator) || Sets... || \brief Sets the widget's geometry to the specified rectangle.
|-
|-
| '''R36''' || Brief without period || Add period || R15
| Function (constructor) || Constructs... || \brief Constructs a widget with the given parent.
|-
| Property || This property holds... || \brief This property holds whether the widget is enabled.
|-
| Signal || This signal is emitted when... || \brief This signal is emitted when the button is clicked.
|}
 
=== G10: Property and signal briefs ===
Formerly R18 and R19. A property description starts with "This property holds...", and a signal description starts with "This signal is emitted when...".
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| '''R37''' || "Neutral voice" || Use "imperative mood" or "indicative mood" || QUIP 25
| <code>\brief Value changed.</code> || <code>\brief This signal is emitted when the value changes.</code>
|}
|}


== Common Substitutions (R38) ==
=== G11: Alt text content ===
Formerly R25 and R27. Prefer visible labels, then the purpose, then a visual description. Use noun phrases, not full sentences.
 
{| class="wikitable"
! Incorrect !! Correct
|-
| <code>{A dialog is shown where details are entered}</code> || <code>{Settings dialog with Save and Cancel buttons}</code>
|}


This section lists words and phrases to avoid in Qt documentation, along with their preferred alternatives. These substitutions improve clarity and accessibility for international readers. Based on [[QUIP 25]] (S2) and [[Microsoft Writing Style Guide]] (S9).
The priority order of alt text:


=== Latin Terms (Always Avoid) ===
# '''Option 1 (recommended):''' include visible text, labels, or icons from the image
# '''Option 2:''' a description of the purpose, behavior, or state
# '''Option 3:''' a generic visual description


Latin abbreviations are not universally understood. Replace them with plain English equivalents.
=== G12: Page-type style ===
Formerly R28, R28b, and R29. API documentation uses imperative briefs and indicative descriptions, with no "you". Tools documentation uses present tense, "you", bold UI elements, and menu paths with the > sign. User guides and tutorials use "you", explain concepts, and use task-oriented titles.


{| class="wikitable"
{| class="wikitable"
! Instead of !! Use !! Source
! Incorrect !! Correct
|-
|-
| e.g. || for example, such as, like || MS Style Guide
| In a tutorial: <code>\section1 The Project</code> followed by "The user will then create a project." || In a tutorial: <code>\section1 Creating a project</code> followed by "You create a project."
|}
 
=== G13: UI markup and menu paths ===
Formerly R42 and R44. Mark UI text with <code>\uicontrol</code>, which renders in bold, and mark each element of a menu path.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| i.e. || that is || MS Style Guide
| Go to File > New Project and click OK. || Go to <code>\uicontrol File &gt; \uicontrol {New Project}</code> and select <code>\uicontrol OK</code>.
|}
 
=== G14: Causal "since" and "as" ===
Formerly part of R38. Use "because" for a cause, and keep "since" for time. "Since Qt 6.5" is fine.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| etc. || (be specific, or use "such as" + examples) || MS Style Guide
| Since the buffer is full, the write fails. || Because the buffer is full, the write fails.
|}
 
=== G15: Link or code font ===
Formerly R46. Use <code>\l</code> for documented public API and <code>\c</code> for private or undocumented API. Check the header and the export macro to decide.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| via || through, using, with, by || QUIP 25, MS Style Guide
| <code>\l{QWidgetPrivate::init()}</code> || <code>\c{QWidgetPrivate::init()}</code>
|}
 
=== G16: QML-to-C++ links ===
Formerly R51b. QML documentation links to QML targets, except in module overviews.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| per || according to, for each || —
| In a QML property: Holds the <code>\l{QTextToSpeech::rate()}{rate}</code>. || In a QML property: Holds the <code>\l{TextToSpeech::rate}{rate}</code>.
|}
 
=== G17: List and table introductions ===
Formerly R54. Introduce every list and table with a sentence that says what it shows.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| versus, vs. || compared to, or, against || —
| <code>\section1 Parameters</code> followed at once by <code>\list</code> || The function accepts the following parameters: followed by <code>\list</code>
|}
|}


==== Sentence Examples ====
=== G19: Admonitions ===
Formerly R63. Use <code>\warning</code> only for serious consequences, and state the consequence.


{| class="wikitable"
{| class="wikitable"
! ❌ Incorrect !! ✅ Correct
! Incorrect !! Correct
|-
|-
| Pass parameters via the constructor. || Pass parameters through the constructor.
| <code>\warning Use with caution.</code> || <code>\warning Calling this from another thread corrupts the model.</code>
|}
 
=== G20: Markup consistency ===
Formerly R64. Mark every code element the same way throughout a page.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| Use containers, e.g., QList or QVector. || Use containers, such as QList or QVector.
| Returns true if enabled; set Qt::AlignLeft ... || Returns <code>\c true</code> if enabled; set <code>\c{Qt::AlignLeft}</code> ...
|}
 
=== G21: Clarity beyond word lists ===
Formerly part of R2. Keep sentences at or under about 20 words, with one idea per sentence.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| The property is read-only, i.e., it cannot be modified. || The property is read-only, that is, it cannot be modified.
| The function, which is called when the model changes and the view is visible, updates the delegate cache and then emits a signal. || The view calls this function when the model changes. It updates the delegate cache and emits a signal.
|}
 
=== G22: Punctuation for relationships ===
Formerly part of R68. After R68 removes a dash, pick the punctuation that names the relationship: a colon, a comma, parentheses, or a period.
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| Supports multiple formats (PNG, JPG, etc.). || Supports multiple formats, such as PNG, JPG, and WebP.
| Two modes are supported, synchronous, and asynchronous. || Two modes are supported: synchronous and asynchronous.
|}
|}


=== Verbose Phrases ===
=== G31: Titles name the topic ===
A title is a label. A reader who scans the table of contents predicts the section from the title alone. Use a noun phrase for reference, overview, module, and report pages, and a gerund phrase for task and tutorial pages. Case follows R12, and a title takes no final period or colon. A title does not state a finding, ask a rhetorical question, carry a status that will change, or use a dash aside.
 
{| class="wikitable"
! Incorrect !! Correct
|-
| <code>\section1 Why signals are better than callbacks</code> || <code>\section1 Signals and slots</code>
|-
| <code>\section1 Deploy Qt applications</code> || <code>\section1 Deploying Qt applications</code>
|}


Replace wordy phrases with concise alternatives to improve readability.
=== G34: Paragraphs and sections ===
A paragraph makes one point, states it first, and stops. The sub-rules are numbered G34.1 to G34.6.


{| class="wikitable"
{| class="wikitable"
! Instead of !! Use !! Source
! Rule !! Summary
|-
| G34.1 || Open with a topic sentence of about 14 words, and never more than 30. Do not announce the point
|-
|-
| In order to || To || QUIP 25, MS Style Guide
| G34.2 || Put the core idea first. The next sentences give a reason, a condition, an example, or an exception
|-
|-
| It is possible to || You can / Can || QUIP 25
| G34.3 || Use one to three sentences, and split above about 100 words
|-
|-
| Make use of || Use || MS Style Guide
| G34.4 || Stop when the point is made, with no closing restatement
|-
|-
| At this point in time || Now || —
| G34.5 || Introduce every list and table with a sentence that says what it shows
|-
|-
| Due to the fact that || Because || —
| G34.6 || Give each section one idea, ordered what, why, and how
|}
 
{| class="wikitable"
! Incorrect !! Correct
|-
|-
| Is able to || Can || —
| This section looks at how the cache behaves. The answer may surprise you. || The cache stores each result until the model changes.
|}
|}


=== Hedging Words (Avoid) ===
== Substitutions and terminology ==
These tables list words and phrases to avoid in Qt documentation, with their preferred replacements. The Vale rules named in R3 and R38 check most of them. The replacements improve clarity for international readers.


These words can be condescending or assume reader knowledge. Avoid them in most contexts.
=== Latin terms ===
Latin abbreviations are not universally understood. Replace them with plain English.


{| class="wikitable"
{| class="wikitable"
! Avoid !! Reason !! Source
! Instead of !! Use !! Source
|-
| e.g. || for example, such as, like || S9
|-
| i.e. || that is || S9
|-
| etc. || and so on, or be specific and use "such as" with examples || S1, S9
|-
|-
| simply, just || Implies task is trivial || QUIP 25
| via || through, using, with, by || S2, S9
|-
|-
| obviously, clearly || Assumes reader knowledge || QUIP 25
| caveat || advice, warning || S1
|-
|-
| easily || May not be easy for reader || QUIP 25
| per || according to, for each || n/a
|-
|-
| please || Use only for inconvenient requests || QUIP 25
| versus, vs. || compared to, or, against || n/a
|}
|}


=== Terminology ===
{| class="wikitable"
! Incorrect !! Correct
|-
| Pass parameters via the constructor. || Pass parameters through the constructor.
|-
| Use containers, e.g., QList or QVector. || Use containers, such as QList or QVector.
|-
| The property is read-only, i.e., it cannot be modified. || The property is read-only, that is, it cannot be modified.
|-
| Supports multiple formats (PNG, JPG, etc.). || Supports multiple formats, such as PNG, JPG, and WebP.
|}


Use Qt's preferred terminology for consistency across all documentation.
=== Verbose phrases ===
Replace wordy phrases with concise alternatives.


{| class="wikitable"
{| class="wikitable"
! Instead of !! Use !! Source
! Instead of !! Use !! Source
|-
|-
| programmer || developer || QUIP 25
| In order to || To || S2, S9
|-
|-
| since, as (for causation) || because || QUIP 25, MS Style Guide
| It is possible to || You can, or Can || S2
|-
|-
| utilize || use || MS Style Guide
| Make use of || Use || S9
|-
| At this point in time || Now || n/a
|-
| Due to the fact that || Because || n/a
|-
| Is able to || Can || n/a
|}
|}


== QDoc Formatting (R39-R41) ==
=== Hedging words ===
 
These words can be condescending or can assume reader knowledge. Avoid them in most contexts.
These rules cover QDoc-specific formatting conventions, including command syntax and line length limits. Based on [[QDoc Style Guidelines]] (S8) and Qt Coding Style.


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Enforcement
! Avoid !! Reason !! Source
|-
| simply, just || Implies the task is trivial || S2
|-
|-
| '''R39''' || '''No space before curly brace''' || QDoc Style Guidelines || '''Recommended''' for compact text. <code>\l{QWidget}</code> preferred over <code>\l {QWidget}</code>. Not strictly enforced.
| obviously, clearly || Assumes reader knowledge || S2
|-
|-
| '''R40''' || '''80-column line length''' || Qt Coding Style, QDoc Style Guidelines || '''CI-enforced.''' For documentation comments and .qdoc files.
| easily || May not be easy for the reader || S2
|-
|-
| '''R41''' || '''\sa targets must match page titles''' || Qt Doc Team practice || '''Required.''' Verify targets resolve to actual pages.
| please || Use only for inconvenient requests || S2
|}
|}


== UI and Tools Documentation (R42-R44) ==
=== Terminology ===
 
Use the preferred Qt terms for consistency.
These rules apply specifically to documentation for Qt tools like Qt Creator and Qt Design Studio. They cover how to format UI elements, keyboard shortcuts, and menu paths. Based on [[Qt Writing Guidelines]] (S1) and Qt Creator documentation conventions.


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Instead of !! Use !! Source
|-
|-
| '''R42''' || '''UI element markup''' || Qt Writing Guidelines, Qt Creator docs || Bold for UI elements: '''File''' > '''New Project'''. In QDoc: <code>\uicontrol{element}</code>
| programmer || developer || S2
|-
|-
| '''R43''' || '''Keyboard shortcut formatting''' || Qt Creator docs || <code>Ctrl+B</code>, sequential: <code>Ctrl+K, Ctrl+D</code>, platform: <code>Ctrl+O</code> (<code>Cmd+O</code> on macOS)
| since, as (for causation; see G14) || because || S2, S9
|-
|-
| '''R44''' || '''Menu path formatting''' || Qt Creator docs || Go to '''File''' > '''New Project''' > '''Qt Quick Application'''
| utilize || use || S9
|}
|}


== Qt Product and Module Names (R3 Detail) ==
=== Product and module names ===
 
Official Qt product and module names use the capitalization and spelling in S7.
Official Qt product and module names must use correct capitalization and spelling. This ensures consistency and brand accuracy across all documentation. Per [[Qt Terms and Concepts]] (S7).


{| class="wikitable"
{| class="wikitable"
! Correct !! Incorrect !! Notes
! Correct !! Incorrect !! Notes
|-
|-
| Qt GUI || Qt Gui, Qt gui || Acronyms all caps
| Qt GUI || Qt Gui, Qt gui || Acronyms in capitals
|-
|-
| Qt SQL || Qt Sql || Acronym all caps
| Qt SQL || Qt Sql || Acronym in capitals
|-
|-
| Qt SVG || Qt Svg || Acronym all caps
| Qt SVG || Qt Svg || Acronym in capitals
|-
|-
| Qt XML || Qt Xml || Acronym all caps
| Qt XML || Qt Xml || Acronym in capitals
|-
|-
| Qt Quick || QtQuick (in prose) || Two words in prose
| Qt Quick || QtQuick (in prose) || Two words in prose
Line 414: Line 815:
|}
|}


== Compound Words (R3 Detail) ==
=== Compound words ===
 
Qt documentation uses these compound word spellings.
Qt documentation uses specific compound word conventions. Use these spellings consistently.


{| class="wikitable"
{| class="wikitable"
Line 438: Line 838:
|}
|}


== Tools-Specific Terminology (R3 Detail) ==
Qt Creator and Qt Design Studio documentation uses a few more terms consistently.
 
Qt Creator and Qt Design Studio use specific terminology that should be used consistently in tools documentation.


{| class="wikitable"
{| class="wikitable"
! Term !! Correct Usage !! Context
! Term !! Correct usage !! Context
|-
|-
| kit || kit (not "configuration set") || Qt Creator
| kit || kit (not "configuration set") || Qt Creator
Line 454: Line 852:
|}
|}


== Linking Style and Syntax (R45-R50) ==
== Enforcement levels ==
 
Rules have different enforcement levels. The level tells you which findings to fix first.
These rules cover how to write links in Qt documentation. Links connect documentation pages and enable navigation. For detailed diagnostics and link resolution debugging, see the [[QDoc Manual]].


{| class="wikitable"
{| class="wikitable"
! Rule !! Summary !! Sources !! Notes
! Level !! Meaning !! Examples
|-
| '''R45''' || '''Basic link syntax''' || QDoc Manual || <code>\l{target}</code>, <code>\l{target}{text}</code>, <code>\l[QML]{target}</code>
|-
| '''R46''' || '''Link vs code formatting''' || Qt Doc Team || Use <code>\l{}</code> for documented/public APIs; <code>\c{}</code> for undocumented/internal
|-
| '''R47''' || '''Section links within type docs''' || Qt Doc Team || Use <code>TypeName#Section Title</code> NOT <code>page.html#anchor</code>
|-
| '''R48''' || '''External page links''' || QDoc Manual || <code>\externalpage</code> with <code>\title</code> must match exactly
|-
| '''R49''' || '''QML cross-module links''' || QDoc Manual || Use <code>::</code> separator: <code>{QtQuick.Controls::ToolTip}</code>
|-
| '''R50''' || '''QML value type case''' || Qt Doc Team || Value types use camelCase: <code>geoCoordinate</code> not <code>GeoCoordinate</code>
|}
 
=== R47 Detail: Section Links ===
 
When linking to a section within a C++ class or QML type documentation page, use the <code>TypeName#Section Title</code> syntax:
 
<pre>
✅ \l{QColor#The HSV Color Model}
✅ \l{ListView#Reusing Items}
❌ \l{qcolor.html#the-hsv-color-model}
</pre>
 
The <code>page.html#anchor</code> syntax only works for explicit <code>\page</code> pages, not auto-generated type pages.
 
=== R46 Detail: Link vs Code Formatting ===
 
{| class="wikitable"
! Situation !! Use !! Example
|-
| Documented public API || <code>\l{}</code> || <code>\l{QWidget::show()}</code>
|-
|-
| Internal/private class || <code>\c{}</code> || <code>\c{QWidgetPrivate::init()}</code>
| '''CI-enforced''' || Checked automatically by CI, the continuous integration system, and fails the build || R40 (80 columns)
|-
|-
| Private header type || <code>\c{}</code> || <code>\c{QPlatformWindow}</code>
| '''Required''' || Must be followed, and a violation causes warnings or broken documentation || R14 (<code>\brief</code> on top-level nodes), R41 (<code>\sa</code> targets)
|-
|-
| External URL || <code>\l{}</code> with <code>\externalpage</code> || <code>\l{CMake Documentation}</code>
| '''Recommended''' || Should be followed and is not strictly enforced || R39 (no space before a brace)
|}
|}


=== R50 Detail: QML Value Type Case ===
== Change history ==
 
This section lists the IDs that were added, renumbered, or retired. A rule that is an '''alias''' points to another rule and adds no check of its own. The list is dated, and the newest entry is first.
QML value types use camelCase (lowercase first letter). Object types use PascalCase.
 
<pre>
// Value types (camelCase):
\l{geoCoordinate::latitude}
\l{webEngineCertificateError::defer()}
 
// Object types (PascalCase):
\l{ListView::delegate}
\l{WebEngineView::url}
</pre>
 
== Enforcement Levels ==
 
Rules have different enforcement levels. Understanding these helps prioritize compliance efforts.
 
{| class="wikitable"
! Level !! Meaning !! Examples
|-
| '''CI-enforced''' || Checked automatically by CI; will fail builds || R40 (80-column)
|-
| '''Required''' || Must be followed; causes warnings or broken docs || R14 (mandatory \brief), R41 (\sa targets)
|-
| '''Recommended''' || Should be followed; not strictly enforced || R39 (no space before brace)
|}


== Notes ==
* '''2026-11-23, draft:''' The IDs R1 to R50 keep their numbers, except the rules that moved to judgment rules. R1, R5, R6, R8, R9, R10, R13, and R17 are now G1, G3, G4, G5, G6, G7, G8, and G9. R18 and R19 are now G10. R25 and R27 are now G11. R28, R28b, and R29 are now G12. R42 and R44 are now G13. R46 is now G15. R51b is now G16, R54 is now G17, R63 is now G19, and R64 is now G20. G2, G14, G21, and G22 split off from R3, R38, R2, and R68.
* '''2026-11-23, draft:''' R30 to R37 become aliases of G1, R4, R2, G7, G5, R14, R15, and G3.
* '''2026-11-23, draft:''' The IDs R51, R52, R53, R55, R56, R58, R59, R60, R61, R62, and R68 are added, and G31 and G34 are new rules.
* '''2026-11-23, draft:''' G18 is retired. C13 to C15 and G32 to G33 are reserved.


* When sources conflict, follow hierarchy: Qt Writing Guidelines → QUIP 25 → C++/QML Doc Style → MS Style Guide
For the next step, read the [[Qt Writing Guidelines]], or its section [[Qt Writing Guidelines#Checking your documentation|Checking your documentation]] if you already have a review comment to fix.
* QDoc Manual is authoritative for '''syntax''' only, not style
* \brief is '''mandatory''' only for classes, QML types, properties, and examples
* \brief is '''recommended''' (not mandatory) for functions, signals, enums, and methods


[[Category:Documentation]]
[[Category:Documentation]]

Revision as of 12:19, 23 November 2026

Work in Progress: The rules are based off official sources in QUIPs and writing guides. However, the rule set is changing and is from the rules merged in qtqa.git

This page is the reference for the Qt documentation rules. Each rule has a stable ID, so a reviewer, a linter message, or a patch comment can cite it, and you can look it up here.

If you are new to Qt documentation, read the Qt Writing Guidelines first. Then use this page when a review comment or a tool message names an ID such as R12 or G34. The numbering is provisional until the Documentation Team approves it, and existing documentation may not comply with every rule.

The rules are prescriptive for new and updated documentation. The table lists the four kinds of ID and what each one means.

Prefix Meaning Example
S A source that defines a standard S2 is QUIP 25
C A content type: the kind of page or text C6 is an overview page
R A rule that a deterministic tool checks using a regular expression R12 is sentence-case titles
G A rule that needs a person's judgment G34 is paragraph structure

Most R rules are checked by Vale, a linter that reads text and reports places that break a rule, or by QDoc, the Qt tool that turns documentation comments and .qdoc files into HTML. A rule can also be checked by a short script. The dotted names in the Check columns, such as Qt.Language.OxfordComma, are Vale rule names. To run Vale, see Setting Up Vale.

If you write a new page, start with these rules: R14 and R15 for the brief, R12 for titles, and G31 and G34 for titles and paragraphs. A QUIP is a Qt Project proposal document, and S2 is the one about documentation style. An imperative sentence is a command, as in "Run the application", and an indicative sentence states a fact, as in "The item ignores events". The "Formerly" notes help readers of old review comments, and you can skip them on a first read. The Sources section is a reference list, and you can skip it on a first read as well.

QDoc commands start with a backslash. The table lists the commands that appear most often in the rules and what each one does.

Command What it does
\brief Sets the one-sentence summary of a page or type
\section1 Starts a top-level section of a page
\l Links to a page or an API item
\sa Adds a "see also" list of links
\uicontrol Marks text that appears in a user interface
\externalpage Declares a page outside the documentation as a link target

Sources

The following sources define Qt documentation standards. When sources conflict, follow the hierarchy: S1, then S2, then S3 and S4, then S9. The QDoc Manual (S10) is authoritative for syntax only, not for style.

ID Source URL Purpose
S1 Qt Writing Guidelines https://wiki.qt.io/Qt_Writing_Guidelines Primary coordination document for all Qt documentation standards
S2 QUIP 25 - Documentation Writing Style https://code.qt.io/cgit/meta/quips.git/plain/quip-0025-Documentation-Writing-Style.rst Language, grammar, word choice, and formatting standards
S3 C++ Documentation Style https://wiki.qt.io/C%2B%2B_Documentation_Style Patterns and requirements for C++ API documentation
S4 QML Documentation Style https://wiki.qt.io/QML_Documentation_Style Patterns and requirements for QML API documentation
S5 Qt Examples Guidelines https://wiki.qt.io/Qt_Examples_Guidelines Code quality, screenshots, and build requirements for examples
S6 Writing Example Documentation and Tutorials https://wiki.qt.io/Writing_Example_Documentation_and_Tutorials 11 mandatory elements and tutorial structure
S7 Qt Terms and Concepts https://wiki.qt.io/Qt_Terms_and_Concepts Official Qt terminology and product naming conventions
S8 QDoc Style Guidelines https://wiki.qt.io/QDoc_Style_Guidelines QDoc command formatting and alt text rules
S9 Microsoft Writing Style Guide https://learn.microsoft.com/en-us/style-guide/welcome/ Supplementary reference when Qt sources do not specify
S10 QDoc Manual https://doc.qt.io/qt-6/qdoc-index.html QDoc command syntax (not a style authority)

For API documentation, the C++ and QML style pages define the requirements for classes, functions, properties, and signals:

Content types

A content type is the kind of page or text that you write. The Writing Guidelines explain how to choose one in plain words, such as class reference, tutorial, or overview. Detect the type first, and then apply only the rules for that type, because a rule such as "use you" fits a tutorial and does not fit an API brief. A brief is the one-sentence summary at the top of a QDoc block, set with the \brief command. A topic command is the command that opens a documentation block for one thing, such as \class, \qmltype, or \page.

The table lists each content type, how to detect it, and its writing register. Detection by topic command is exact. Detection by page name is a heuristic, and a page that fits no type is treated as C6.

ID Type Detect by Register
C1 C++ API reference \class, \fn, \property, \enum, \macro, \typedef, \namespace G23
C2 QML API reference \qmltype, \qmlproperty, \qmlmethod, \qmlsignal, \qmlvaluetype G23
C3 Module page \module, \qmlmodule, \page *-index.html G25
C4 Example \example; example group: \group *_examples G25 or G24
C5 Tutorial and getting started \page name matches tutorial, getting-started, or first (heuristic) G24
C6 Overview and concept page Any other \page (fallback) G25
C7 Platform and deployment \page name matches a platform (android, ios, wasm, windows, macos, linux, embedded) or deploy (heuristic) G24
C8 Porting, changes, and what's new \page name matches porting, changes, whatsnew, or new-in (heuristic) G29, G24, or G25
C9 Qt Creator and Qt Design Studio documentation Qt Creator and Qt Design Studio sources G24 or G23
C10 External page declaration \externalpage None
C11 Legal and license text License headers, \legalese, third-party notices G28
C12 Qt Framework development tools \page under a tools documentation directory, or named qtqml-tooling-* (heuristic) G23 or G24
C16 Commit message The commit message of a change, not a QDoc topic G25, and G29 for a [ChangeLog] entry
C17 Report and proposal A report, proposal, or summary document, not a QDoc topic G25

C13, C14, and C15 are reserved IDs for the Qt Blog post, the qt.io product page, and the Qt Forum post. No rule uses them yet, and the gap is not an error.

Registers

A register is the way a type of text sounds: its person, tense, mood, and sentence length. A reference entry and a tutorial step follow different registers, so the same sentence can be right in one and wrong in the other. Each content type expects one register.

When the Microsoft Writing Style Guide (S9) and a register disagree, the register wins. Rules G1 to G22 still apply inside every register.

G23: Reference register

Used for C1 and C2, and for reference pages of C9 and C12. The text lets the reader look up one fact fast: third person, present tense, indicative, one fact per sentence. It does not teach and it has no steps. It uses "you" only in usage notes about the reader's own code.

Incorrect Correct
Now let's add a few items and watch the list grow. Appends \a value to the list.

G24: Tutorial register

Used for C5 and C7, and for C4 walkthroughs, C8 porting steps, and C9 and C12 usage pages. The text walks the reader through steps in order, with "you" and imperative sentences. State the result instead of giving reassurance.

Incorrect Correct
Don't worry, you should see a window appear. Run the application. A window opens.

G25: Conceptual register

Used for C3, C6, C16, and C17, and for C4 descriptions and C7 and C8 explanations. The text builds a mental model: what something is, why it exists, and when to use it. It uses third person, or "you" when the reader makes a choice, in present tense. Each paragraph opens with a plain topic sentence, sections go from what, to why, to how, and the text uses at most one analogy. It does not list API facts or give steps. It links to the reference page or the tutorial instead.

Incorrect Correct
The connect() function takes five parameters. Signals and slots let objects communicate without knowing which objects receive the signal.

G26: Essay register

Used for persuasive writing, such as a blog post or a design rationale, and not for pages on doc.qt.io. It uses contrasts, aphorisms, rhetorical questions, and one-sentence paragraphs for punch. A "why" section in an overview page may hold at most one contrast and no aphorisms. In C1 to C5, C7 to C9, and C12 it is a finding.

Incorrect Correct
The copy is not an inconvenience; it is the whole point. A queued connection copies its arguments because the slot runs later, on another thread.

G27: Marketing register

Used for product pages and launch posts. It leads with benefits and uses superlatives, exclamations, and fragments. A module page or a what's-new page may hold one or two introductory sentences that state facts. In API reference, examples, tutorials, and overviews it is a finding.

Incorrect Correct
Build stunning apps faster than ever, with one codebase for every screen. Qt Quick applications run on desktop, mobile, and embedded platforms.

G28: Legal register

Used for C11. It defines obligations, so "shall" and "must" are allowed. Review Qt-authored \legalese notices only, and never rewrite third-party license text.

G29: Release notes register

Used for change lists in C8. It records what changed, in past tense, starting with the verb, with one change per item. Planned removals, such as "will be removed in Qt 7", keep the future tense.

Incorrect Correct
We've gone ahead and removed the old API. Removed QFoo::oldValue(). Use QFoo::value() instead.

G30: Conversational register

Used for forum posts, chat, and code review comments. It allows filler, loose grammar, and the first person singular. In pages of C1 to C9 and C12 it is a finding, apart from common contractions and a rare "we recommend" when no other wording works. A sentence-initial "So" that acts as filler is a finding in new text.

Incorrect Correct
So, to use the model, set it on the view. To use the model, set it on the view.

Tool-checkable rules

A tool checks each rule in this section. The check is a Vale rule, a QDoc warning message, a pattern search, or a short script, and the table of each group names it. A page passes a rule when its check reports nothing.

The 36 rules keep the IDs that this page used before. They are grouped by topic: language, grammar, API markup, links, examples and images, and QDoc formatting. Rules that need judgment, such as active voice, are in the next section.

Language

These rules keep wording concise and consistent. The table lists each rule and its check.

Rule Summary Check Notes
R2 Be clear and concise Vale Qt.Language.WordyConstructions, Qt.Language.WordyFillers, Qt.Language.WordyQuantifier Drop filler. "To" not "In order to"
R3 Use correct terminology Vale Qt.Language.QtTerminology Product and module names are spelled exactly. Use "widget" not "control", "type" not "component", "developer" not "programmer". See Substitutions and terminology
R4 Use present tense Vale Qt.Language.FutureTense "Returns true" not "Will return true". Planned removals, such as "will be removed in Qt 7", are exempt
R7 Avoid jargon and idioms Vale Qt.Language.Idioms An idiom is hard to translate and is replaced with a plain word
R38 Use the substitutions Vale Qt.Language.HedgingWords, Qt.Language.LatinTerms, Qt.Language.LoseLoose; pattern search for the verb "land" Hedging words, Latin terms, "lose" and "loose", and the verb "land". Write the verb you mean: "merge" for a change, "is included in" for a release, "ends up in" for a result. "Landing page" passes

The examples show each rule with an incorrect and a correct form.

Rule Incorrect Correct
R2 In order to enable the feature, you need to set the property. Set the property to enable the feature.
R2 This is kind of complex and needs a lot of setup. This is complex and needs several setup steps.
R3 The programmer can use any control. The developer can use any widget.
R3 Qt5 and QtQuick support this. Qt 5 and Qt Quick support this.
R4 The function will return true if successful. The function returns true if successful.
R7 The cache works under the hood. The cache works automatically.
R38 Simply configure it via the settings, e.g. the kit. Configure it through the settings, for example the kit.
R38 The fix landed in 6.5. The fix is included in 6.5.

Grammar

These rules cover punctuation and capitalization.

Rule Summary Check Notes
R11 Use a serial (Oxford) comma Vale Qt.Language.OxfordComma "name, value, and type" not "name, value and type"
R12 Use sentence case for titles A script that classifies each title; Vale Microsoft.Headings checks one title at a time "Getting started with Qt Quick" not "Getting Started With Qt Quick". A page may use title case instead, but only when every title on the page does. The script reports the titles that differ from the form of the page. Table header cells always use sentence case
R68 No em dash as a connector Vale Microsoft.Dashes; pattern search for the em dash character Choose the punctuation that names the relationship. See G22
Rule Incorrect Correct
R11 name, value and type name, value, and type
R12 A page with the titles "Getting started", "Building your first application", and "Running The Example" The same page with "Running the example"
R12 Getting Started With Qt Quick Getting started with Qt Quick
R68 The model -- which is shared -- updates the view. (written with a long dash in place of the two hyphens) The model, which is shared, updates the view.

API markup

These rules cover the QDoc commands that every documented API and module page needs. A top-level node is the start of a documentation block, such as \class, \qmltype, \page, or \example.

Rule Summary Check Notes
R14 \brief on top-level nodes Script: a block that opens with a top-level command has no \brief Required for \class, \struct, \union, \namespace, \headerfile, \qmltype, \qmlvaluetype, \page, \example, \module, \qmlmodule, and \group. Member nodes such as \fn, \enum, and \qmlproperty need none. QDoc has no warning for a missing brief. QDoc uses the brief in lists of types, in index files, and in the page description
R15 Briefs end with a period Vale Qt.Structure.QDocBrief; QDoc message '\brief' statement does not end with a full stop Applies to every brief that is provided
R16 A class has \inmodule QDoc message has no \inmodule command A class needs \class, \brief, \inmodule, and \since. The \since version comes from the version control history of the file
R51 Generic QML types Vale Qt.Structure.QMLGenericTypes Use object, not a C++ pointer type, in QML method signatures
R58 Module landing page Vale Qt.Structure.ModuleExamplesSection, Qt.Structure.ModuleReferenceSection A module page has an Examples section and a Reference section
R59 Example group Vale Qt.Structure.ExampleGroupIngroup A group of examples has \ingroup all-examples
R62 Module review checklist A combination of R58, R59, R61, and R15 on the landing page One report line per item, each with its tool output
Rule Incorrect Correct
R14 /*! \class QFoo \inmodule QtCore */ /*! \class QFoo \inmodule QtCore \brief The QFoo class stores a range. */
R15 \brief Returns the width \brief Returns the width.
R16 /*! \class QFoo \brief ... */ /*! \class QFoo \inmodule QtCore \brief ... */
R51 \qmlmethod QObject* Instantiator::objectAt(int index) \qmlmethod object Instantiator::objectAt(int index)
R58 \page qtfoo-index.html and \title Qt Foo with no Examples or Reference section The same page with \section1 Examples and \section1 Reference
R59 \group qtfoo_examples and \title Qt Foo Examples The same group with \ingroup all-examples

The brief patterns of the individual API entries are judgment rules, and they are in G9 and G10. This template shows a class block with the required commands. It is a comment in a C++ source file:

/*!
    \class QWidget
    \brief The QWidget class is the base class of all user interface objects.
    \inmodule QtWidgets
    \since 4.0

    A widget is the atom of the user interface...
*/

Links

These rules cover how a link is written. Links connect documentation pages. For the diagnosis of a broken link, see the QDoc Manual. R45, R48, R49, R50, and R60 share one check: QDoc reports Can't link to '<target>'.

Rule Summary Check Notes
R45 Basic link syntax QDoc message \l{target}, \l{target}{text}, \l[QML]{target}
R47 Section links within type documentation Vale Qt.Structure.SectionLinkAntiPattern Use TypeName#Section Title, not page.html#anchor. The page.html#anchor form works only for explicit \page pages, not for generated type pages
R48 External page links QDoc message The \externalpage title and the link target match exactly
R49 QML cross-module links QDoc message Use the :: separator: {QtQuick.Controls::ToolTip}
R50 QML value type case QDoc message Value types use camelCase: geoCoordinate, not GeoCoordinate. Object types use PascalCase
R60 Cross-module linking QDoc message A link into another module needs that module in the dependencies of the .qdocconf file, the configuration file of the documentation build
R61 Configuration dependencies QDoc message; a pattern search of depends += lines The .qdocconf file lists every linked module
Rule Incorrect Correct
R45 \l QWidget{the widget} \l{QWidget}{the widget}
R47 \l{qcolor.html#the-hsv-color-model} \l{QColor#The HSV Color Model}
R48 \l{Qt Wiki Writing Guidelines} when the title is "Qt Writing Guidelines" \l{Qt Writing Guidelines}
R49 \l QtQuick.Controls.ToolTip.delay \l{QtQuick.Controls::ToolTip::delay}
R50 \l{GeoCoordinate::latitude} \l{geoCoordinate::latitude}
R60 \l{QNetworkReply} from a module whose configuration lacks qtnetwork The same link, with depends += qtnetwork
R61 Links to QtNetwork types and depends += qtcore depends += qtcore qtnetwork

Examples and images

These rules cover example documentation and images. They keep examples complete and keep images accessible to readers who use a screen reader. Alt text is the text that describes an image for a screen reader and appears when the image fails to load.

Rule Summary Check Notes
R20 11 mandatory elements Script on the file that holds \example Title, \example, \brief, \examplecategory, image, overview, running instructions, platform notes, main content, references, licenses
R21 Zero warnings Pattern search of the build log for warning:; qmllint exits with 0 The C++ compiler and qmllint must produce no warnings
R22 Screenshot size Image size check At least 440 by 320 pixels for high-DPI screenshots, and icons at least 64 by 64. WebP is the preferred format
R23 Example titles Vale Qt.Structure.ExampleTitleRepetition Do not repeat "Example" or the module name in the title
R24 Alt text format Vale Qt.Structure.AltTextFormat Capital first letter and no final period: {Window with toolbar and buttons}
R26 Alt text terms Vale Qt.Structure.AltTextClassNames Use generic lowercase UI terms: "button", not "Button" or "PushButton"
Rule Incorrect Correct
R20 \example gauge and \title Gauge, with no \brief and no \examplecategory The same page with \brief Shows a gauge., \examplecategory {User Interface Components}, and \image gauge.webp {Gauge at 40 percent}
R21 main.cpp:12: warning: unused variable 'w' A build log with no warning: lines
R22 An image of 320 by 240 pixels An image of 880 by 640 pixels
R23 \title Qt Quick Example: Button Example \title Button
R24 \image toolbar.png {toolbar with dark mode toggle.} \image toolbar.png {Toolbar with dark mode toggle}
R26 {Dialog with a PushButton and a CheckBox} {Dialog with a button and a checkbox}

The \image command goes in a .qdoc file or a documentation comment. An alt text on the same line as \image must fit within 80 columns. If it does not, move it to the next line and indent it to align with the file name:

// Same line (within 80 columns):
\image qtquickcontrols-button-custom.png {Custom styled button}

// Next line (if exceeds 80 columns), indented to align with filename:
\image qtquickcontrols-switch.png
       {Switch control labeled Switch in off state}

Alt text for different images follows the pattern in the table. The judgment about what to include is G11.

Image type Incorrect Correct
Screenshot Screenshot of the main window {Window with toolbar containing dark mode toggle and buttons}
Control demo Image showing a button {Button in various interaction states}
Custom styling A customized switch control {Custom styled switch in on and off states}
Wireframe Diagram of page layout {Page wireframe with header, content area, and footer}
Example app Screenshot of example {Qt logo with three light types and lighting controls}
Chart or diagram Bar chart showing data {Sales increased 25% in Q3}

QDoc formatting

These rules cover command syntax, line length, lists, tables, and keyboard shortcuts. R52 limits a list to between two and seven items.

Rule Summary Check Notes
R39 No space before a curly brace Vale Qt.Structure.NoSpaceBeforeBrace Recommended for compact text. \l{QWidget} is preferred over \l {QWidget}. Both forms parse the same. Not strictly enforced
R40 80-column line length Vale Qt.Mechanics.LineLength CI-enforced. For documentation comments and .qdoc files. Table rows count
R41 \sa targets resolve QDoc message Can't link to ' Required. Each \sa target must resolve to an actual page or member
R43 Keyboard shortcut formatting Vale Qt.Structure.KeyboardShortcutFormat Ctrl+B; sequence: Ctrl+K, Ctrl+D; platform: Ctrl+O (Cmd+O on macOS)
R52 List length Script: counts the \li items between \list and \endlist A list has two to seven items. A list of one item becomes a sentence
R53 List punctuation Vale Qt.Structure.ListItemPunctuation, Microsoft.Semicolon No trailing and or comma at the end of an item
R55 Empty table cells Vale Qt.Structure.TableEmptyCell Write "None" in an empty cell. A Notes column is exempt
R56 Table headers Vale Qt.Structure.TableGenericHeaders A header names its column: "Property" and "Default value", not "Name" and "Value"
Rule Incorrect Correct
R39 See \l {QWidget}. See \l{QWidget}.
R40 A 95-character \li line The same line wrapped at 80
R41 \sa setWidht() \sa setWidth()
R43 Press Control+B or Ctrl + B. Press Ctrl+B (Cmd+B on macOS).
R52 A list with one \li item, "The widget" The function takes the widget.
R53 \li The width, and \li The width
R55 \row \li height \li \row \li height \li None
R56 \header \li Name \li Value \header \li Property \li Default value

Judgment rules

A person checks each rule in this section, because no tool can decide it reliably. A reviewer cites the ID, and a Vale rule may shortlist candidates. The 23 rules are G1 to G22 without G18, plus G31 and G34. Each entry shows its former wiki ID, when it has one, and one incorrect and one correct example.

G18 is retired and G32 and G33 are reserved. The page lists them so that a gap in the numbers is not mistaken for an error.

G1: Active voice

Formerly R1. Prefer active voice. Passive voice is fine when the actor is unknown or does not matter.

Incorrect Correct
Events are ignored by the item when disabled. The item ignores events when disabled.

G2: Terminology beyond the list

Formerly part of R3. Terms that R3 does not list are checked against Qt Terms and Concepts (S7).

Incorrect Correct
Add the element to the QML scene tree. Add the item to the Qt Quick scene.

G3: Imperative mood

Formerly R5 and R37. Briefs and instructions use the imperative mood, and descriptions use the indicative mood. Class and type briefs follow the pattern "The X class provides...". In review comments, write "imperative mood" or "indicative mood", not "neutral voice".

Incorrect Correct
\brief This function is used to set the width. \brief Sets the width.

G4: Addressing the reader

Formerly R6. Use "you" when the sentence is about a step or a choice of the reader, or about a requirement on the reader's code. Use third person when the sentence is about what the API or tool does, and for a definition or a property value. Do not replace "you" with "one", "the developer", "the programmer", or "we".

Incorrect Correct
One can configure the kit in the settings. You can configure the kit in the settings.
In API reference: You can use this function to get the size of the list. In API reference: Returns the size of the list.

G5: Consistency

Formerly R8, with R34 as an alias. Use one term for one concept on a page.

Incorrect Correct
Add a delegate to the list view. The ListView then... Add a delegate to the list view. The list view then...

G6: Parallel structure

Formerly R9. Items of a list use the same grammatical form.

Incorrect Correct
Set the model; Calling reset(); You should verify it. Set the model; Call reset(); Verify the result.

G7: Ambiguous pronouns

Formerly R10, with R33 as an alias. Repeat the noun when "it" or "this" is unclear.

Incorrect Correct
The view updates the model. It is refreshed first. The view updates the model. The model is refreshed first.

G8: Numbers

Formerly R13. Spell out one to nine. Use numerals for 10 and up, for dimensions, versions, and code values.

Incorrect Correct
The function takes 3 arguments. The function takes three arguments.

G9: Function briefs

Formerly R17. A function brief starts with the verb for the operation: "Returns...", "Sets...", "Constructs...". A member node needs no \brief (R14), so a brief is recommended here, not mandatory.

Incorrect Correct
\brief The width getter. \brief Returns the width.

The patterns below cover the brief of each kind of entry.

Type Pattern Example
Class The [Class] class provides or is... \brief The QWidget class is the base class of all user interface objects.
Function (accessor) Returns... \brief Returns the current value of the property.
Function (mutator) Sets... \brief Sets the widget's geometry to the specified rectangle.
Function (constructor) Constructs... \brief Constructs a widget with the given parent.
Property This property holds... \brief This property holds whether the widget is enabled.
Signal This signal is emitted when... \brief This signal is emitted when the button is clicked.

G10: Property and signal briefs

Formerly R18 and R19. A property description starts with "This property holds...", and a signal description starts with "This signal is emitted when...".

Incorrect Correct
\brief Value changed. \brief This signal is emitted when the value changes.

G11: Alt text content

Formerly R25 and R27. Prefer visible labels, then the purpose, then a visual description. Use noun phrases, not full sentences.

Incorrect Correct
{A dialog is shown where details are entered} {Settings dialog with Save and Cancel buttons}

The priority order of alt text:

  1. Option 1 (recommended): include visible text, labels, or icons from the image
  2. Option 2: a description of the purpose, behavior, or state
  3. Option 3: a generic visual description

G12: Page-type style

Formerly R28, R28b, and R29. API documentation uses imperative briefs and indicative descriptions, with no "you". Tools documentation uses present tense, "you", bold UI elements, and menu paths with the > sign. User guides and tutorials use "you", explain concepts, and use task-oriented titles.

Incorrect Correct
In a tutorial: \section1 The Project followed by "The user will then create a project." In a tutorial: \section1 Creating a project followed by "You create a project."

G13: UI markup and menu paths

Formerly R42 and R44. Mark UI text with \uicontrol, which renders in bold, and mark each element of a menu path.

Incorrect Correct
Go to File > New Project and click OK. Go to \uicontrol File > \uicontrol {New Project} and select \uicontrol OK.

G14: Causal "since" and "as"

Formerly part of R38. Use "because" for a cause, and keep "since" for time. "Since Qt 6.5" is fine.

Incorrect Correct
Since the buffer is full, the write fails. Because the buffer is full, the write fails.

G15: Link or code font

Formerly R46. Use \l for documented public API and \c for private or undocumented API. Check the header and the export macro to decide.

Incorrect Correct
\l{QWidgetPrivate::init()} \c{QWidgetPrivate::init()}

G16: QML-to-C++ links

Formerly R51b. QML documentation links to QML targets, except in module overviews.

Incorrect Correct
In a QML property: Holds the \l{QTextToSpeech::rate()}{rate}. In a QML property: Holds the \l{TextToSpeech::rate}{rate}.

G17: List and table introductions

Formerly R54. Introduce every list and table with a sentence that says what it shows.

Incorrect Correct
\section1 Parameters followed at once by \list The function accepts the following parameters: followed by \list

G19: Admonitions

Formerly R63. Use \warning only for serious consequences, and state the consequence.

Incorrect Correct
\warning Use with caution. \warning Calling this from another thread corrupts the model.

G20: Markup consistency

Formerly R64. Mark every code element the same way throughout a page.

Incorrect Correct
Returns true if enabled; set Qt::AlignLeft ... Returns \c true if enabled; set \c{Qt::AlignLeft} ...

G21: Clarity beyond word lists

Formerly part of R2. Keep sentences at or under about 20 words, with one idea per sentence.

Incorrect Correct
The function, which is called when the model changes and the view is visible, updates the delegate cache and then emits a signal. The view calls this function when the model changes. It updates the delegate cache and emits a signal.

G22: Punctuation for relationships

Formerly part of R68. After R68 removes a dash, pick the punctuation that names the relationship: a colon, a comma, parentheses, or a period.

Incorrect Correct
Two modes are supported, synchronous, and asynchronous. Two modes are supported: synchronous and asynchronous.

G31: Titles name the topic

A title is a label. A reader who scans the table of contents predicts the section from the title alone. Use a noun phrase for reference, overview, module, and report pages, and a gerund phrase for task and tutorial pages. Case follows R12, and a title takes no final period or colon. A title does not state a finding, ask a rhetorical question, carry a status that will change, or use a dash aside.

Incorrect Correct
\section1 Why signals are better than callbacks \section1 Signals and slots
\section1 Deploy Qt applications \section1 Deploying Qt applications

G34: Paragraphs and sections

A paragraph makes one point, states it first, and stops. The sub-rules are numbered G34.1 to G34.6.

Rule Summary
G34.1 Open with a topic sentence of about 14 words, and never more than 30. Do not announce the point
G34.2 Put the core idea first. The next sentences give a reason, a condition, an example, or an exception
G34.3 Use one to three sentences, and split above about 100 words
G34.4 Stop when the point is made, with no closing restatement
G34.5 Introduce every list and table with a sentence that says what it shows
G34.6 Give each section one idea, ordered what, why, and how
Incorrect Correct
This section looks at how the cache behaves. The answer may surprise you. The cache stores each result until the model changes.

Substitutions and terminology

These tables list words and phrases to avoid in Qt documentation, with their preferred replacements. The Vale rules named in R3 and R38 check most of them. The replacements improve clarity for international readers.

Latin terms

Latin abbreviations are not universally understood. Replace them with plain English.

Instead of Use Source
e.g. for example, such as, like S9
i.e. that is S9
etc. and so on, or be specific and use "such as" with examples S1, S9
via through, using, with, by S2, S9
caveat advice, warning S1
per according to, for each n/a
versus, vs. compared to, or, against n/a
Incorrect Correct
Pass parameters via the constructor. Pass parameters through the constructor.
Use containers, e.g., QList or QVector. Use containers, such as QList or QVector.
The property is read-only, i.e., it cannot be modified. The property is read-only, that is, it cannot be modified.
Supports multiple formats (PNG, JPG, etc.). Supports multiple formats, such as PNG, JPG, and WebP.

Verbose phrases

Replace wordy phrases with concise alternatives.

Instead of Use Source
In order to To S2, S9
It is possible to You can, or Can S2
Make use of Use S9
At this point in time Now n/a
Due to the fact that Because n/a
Is able to Can n/a

Hedging words

These words can be condescending or can assume reader knowledge. Avoid them in most contexts.

Avoid Reason Source
simply, just Implies the task is trivial S2
obviously, clearly Assumes reader knowledge S2
easily May not be easy for the reader S2
please Use only for inconvenient requests S2

Terminology

Use the preferred Qt terms for consistency.

Instead of Use Source
programmer developer S2
since, as (for causation; see G14) because S2, S9
utilize use S9

Product and module names

Official Qt product and module names use the capitalization and spelling in S7.

Correct Incorrect Notes
Qt GUI Qt Gui, Qt gui Acronyms in capitals
Qt SQL Qt Sql Acronym in capitals
Qt SVG Qt Svg Acronym in capitals
Qt XML Qt Xml Acronym in capitals
Qt Quick QtQuick (in prose) Two words in prose
Qt Add-Ons Qt Addon, Qt Addons Hyphenated
Qt D-Bus Qt DBus, Qt DBUS Hyphenated
Qt Creator QtCreator Two words
QDoc Qdoc, qdoc CamelCase

Compound words

Qt documentation uses these compound word spellings.

Correct Incorrect
checkbox check box
filename file name
namespace name space
runtime run time, run-time
framerate frame rate
toolchain tool chain
codebase code base
standalone stand-alone

Qt Creator and Qt Design Studio documentation uses a few more terms consistently.

Term Correct usage Context
kit kit (not "configuration set") Qt Creator
toolchain toolchain (not "tool chain") All
build system build system (not "buildsystem") All
mode Edit mode, Design mode, Debug mode Qt Creator, Qt Design Studio

Enforcement levels

Rules have different enforcement levels. The level tells you which findings to fix first.

Level Meaning Examples
CI-enforced Checked automatically by CI, the continuous integration system, and fails the build R40 (80 columns)
Required Must be followed, and a violation causes warnings or broken documentation R14 (\brief on top-level nodes), R41 (\sa targets)
Recommended Should be followed and is not strictly enforced R39 (no space before a brace)

Change history

This section lists the IDs that were added, renumbered, or retired. A rule that is an alias points to another rule and adds no check of its own. The list is dated, and the newest entry is first.

  • 2026-11-23, draft: The IDs R1 to R50 keep their numbers, except the rules that moved to judgment rules. R1, R5, R6, R8, R9, R10, R13, and R17 are now G1, G3, G4, G5, G6, G7, G8, and G9. R18 and R19 are now G10. R25 and R27 are now G11. R28, R28b, and R29 are now G12. R42 and R44 are now G13. R46 is now G15. R51b is now G16, R54 is now G17, R63 is now G19, and R64 is now G20. G2, G14, G21, and G22 split off from R3, R38, R2, and R68.
  • 2026-11-23, draft: R30 to R37 become aliases of G1, R4, R2, G7, G5, R14, R15, and G3.
  • 2026-11-23, draft: The IDs R51, R52, R53, R55, R56, R58, R59, R60, R61, R62, and R68 are added, and G31 and G34 are new rules.
  • 2026-11-23, draft: G18 is retired. C13 to C15 and G32 to G33 are reserved.

For the next step, read the Qt Writing Guidelines, or its section Checking your documentation if you already have a review comment to fix.