Qt Documentation Rules: Difference between revisions
No edit summary |
|||
| Line 1: | Line 1: | ||
'''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. | ||
{| 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 | |||
{| 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 | | 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 | 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. | |||
== 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. | |||
= | {| class="wikitable" | ||
! Incorrect !! Correct | |||
|- | |||
| Now let's add a few items and watch the list grow. || Appends <code>\a value</code> 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. | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 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. | |||
{| class="wikitable" | |||
! Incorrect !! Correct | |||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| ' | | 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 | |||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| ''' | | '''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" | ||
|- | |- | ||
| ''' | | '''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]] | ||
|- | |- | ||
| ''' | | '''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 | ||
|- | |- | ||
| ''' | | '''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 | |||
|} | |} | ||
The examples show each rule with an incorrect and a correct form. | |||
{| class="wikitable" | {| class="wikitable" | ||
! Rule !! | ! Rule !! Incorrect !! Correct | ||
|- | |- | ||
| | | R2 || In order to enable the feature, you need to set the property. || Set the property to enable the feature. | ||
|- | |- | ||
| R2 || | | 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. | ||
|- | |- | ||
| | | 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. | |||
{| class="wikitable" | |||
! Rule !! Summary !! Check !! Notes | |||
|- | |- | ||
| | | '''R11''' || '''Use a serial (Oxford) comma''' || Vale <code>Qt.Language.OxfordComma</code> || "name, value, and type" not "name, value and type" | ||
|- | |- | ||
| | | '''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 | ||
|- | |- | ||
| | | '''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 | ||
|} | |} | ||
{| class="wikitable" | {| class="wikitable" | ||
! Rule !! | ! 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 || <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 | === 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 | |||
{| class="wikitable" | {| class="wikitable" | ||
! Rule !! Summary !! | ! Rule !! Summary !! Check !! Notes | ||
|- | |- | ||
| '''R14''' || '''\brief | | '''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''' || | | '''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''' || ''' | | '''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 | ||
|- | |- | ||
| ''' | | '''R51''' || '''Generic QML types''' || Vale <code>Qt.Structure.QMLGenericTypes</code> || Use <code>object</code>, not a C++ pointer type, in QML method signatures | ||
|- | |- | ||
| ''' | | '''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 | ||
|- | |- | ||
| ''' | | '''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 | |||
|} | |} | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Rule !! Incorrect !! Correct | ||
|- | |- | ||
| | | R14 || <code>/*! \class QFoo \inmodule QtCore */</code> || <code>/*! \class QFoo \inmodule QtCore \brief The QFoo class stores a range. */</code> | ||
|- | |- | ||
| | | R15 || <code>\brief Returns the width</code> || <code>\brief Returns the width.</code> | ||
|- | |- | ||
| | | R16 || <code>/*! \class QFoo \brief ... */</code> || <code>/*! \class QFoo \inmodule QtCore \brief ... */</code> | ||
|- | |- | ||
| | | R51 || <code>\qmlmethod QObject* Instantiator::objectAt(int index)</code> || <code>\qmlmethod object Instantiator::objectAt(int index)</code> | ||
|- | |- | ||
| | | 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> | ||
|- | |- | ||
| | | R59 || <code>\group qtfoo_examples</code> and <code>\title Qt Foo Examples</code> || The same group with <code>\ingroup all-examples</code> | ||
|} | |} | ||
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> | ||
== | === 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 '<target>'</code>. | |||
{| 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 !! | ! Rule !! Incorrect !! Correct | ||
|- | |||
| R45 || <code>\l QWidget{the widget}</code> || <code>\l{QWidget}{the widget}</code> | |||
|- | |- | ||
| | | R47 || <code>\l{qcolor.html#the-hsv-color-model}</code> || <code>\l{QColor#The HSV Color Model}</code> | ||
|- | |- | ||
| | | R48 || <code>\l{Qt Wiki Writing Guidelines}</code> when the title is "Qt Writing Guidelines" || <code>\l{Qt Writing Guidelines}</code> | ||
|- | |- | ||
| | | R49 || <code>\l QtQuick.Controls.ToolTip.delay</code> || <code>\l{QtQuick.Controls::ToolTip::delay}</code> | ||
|- | |- | ||
| | | 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> | |||
|} | |} | ||
== | === 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. | |||
{| 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 !! | ! 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 | |||
|- | |- | ||
| | | R22 || An image of 320 by 240 pixels || An image of 880 by 640 pixels | ||
|- | |- | ||
| | | R23 || <code>\title Qt Quick Example: Button Example</code> || <code>\title Button</code> | ||
|- | |- | ||
| | | R24 || <code>\image toolbar.png {toolbar with dark mode toggle.}</code> || <code>\image toolbar.png {Toolbar with dark mode toggle}</code> | ||
|- | |- | ||
| | | R26 || <code>{Dialog with a PushButton and a CheckBox}</code> || <code>{Dialog with a button and a checkbox}</code> | ||
|} | |} | ||
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 | ! 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 | | 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. | |||
{| class="wikitable" | |||
! Rule !! Summary !! Check !! Notes | |||
|- | |||
| '''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" | |||
|} | |||
= | {| 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> | |||
|} | |||
== 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. | |||
{| 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. | |||
|} | |||
=== 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". | |||
= | {| class="wikitable" | ||
! Incorrect !! Correct | |||
|- | |||
| <code>\brief This function is used to set the width.</code> || <code>\brief Sets the width.</code> | |||
|} | |||
=== 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" | ||
! | ! 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. | |||
{| class="wikitable" | |||
! 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. | |||
{| 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" | ||
! | ! 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. | |||
{| class="wikitable" | |||
! 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 <code>\brief</code> (R14), so a brief is recommended here, not mandatory. | |||
{| class="wikitable" | |||
! Incorrect !! Correct | |||
|- | |- | ||
| | | <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 | |||
|- | |- | ||
| | | 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...". | |||
{| class="wikitable" | |||
! Incorrect !! Correct | |||
|- | |- | ||
| | | <code>\brief Value changed.</code> || <code>\brief This signal is emitted when the value changes.</code> | ||
|} | |} | ||
== | === 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> | |||
|} | |||
The priority order of alt text: | |||
# '''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 | |||
=== 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" | ||
! | ! Incorrect !! Correct | ||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| | | Go to File > New Project and click OK. || Go to <code>\uicontrol File > \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 | |||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| | | <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 | |||
|- | |- | ||
| | | 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 | |||
|- | |- | ||
| | | <code>\section1 Parameters</code> followed at once by <code>\list</code> || The function accepts the following parameters: followed by <code>\list</code> | ||
|} | |} | ||
=== | === G19: Admonitions === | ||
Formerly R63. Use <code>\warning</code> only for serious consequences, and state the consequence. | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Incorrect !! Correct | ||
|- | |- | ||
| | | <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 | |||
|- | |- | ||
| | | 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 | | 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 | |||
|- | |- | ||
| | | 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. | |||
{| 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> | |||
|} | |||
=== 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" | ||
! | ! 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 | ||
|} | |||
{| class="wikitable" | |||
! 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. | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 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 | ||
|} | |} | ||
= | {| 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. | |||
|} | |||
=== Verbose phrases === | |||
Replace wordy phrases with concise alternatives. | |||
{| class="wikitable" | {| class="wikitable" | ||
! Instead of !! Use !! Source | ! 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. | |||
These | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 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. | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 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. | |||
Official Qt product and module names | |||
{| class="wikitable" | {| class="wikitable" | ||
! Correct !! Incorrect !! Notes | ! Correct !! Incorrect !! Notes | ||
|- | |- | ||
| Qt GUI || Qt Gui, Qt gui || Acronyms | | Qt GUI || Qt Gui, Qt gui || Acronyms in capitals | ||
|- | |- | ||
| Qt SQL || Qt Sql || Acronym | | Qt SQL || Qt Sql || Acronym in capitals | ||
|- | |- | ||
| Qt SVG || Qt Svg || Acronym | | Qt SVG || Qt Svg || Acronym in capitals | ||
|- | |- | ||
| Qt XML || Qt Xml || Acronym | | 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 | === Compound words === | ||
Qt documentation uses these compound word spellings. | |||
Qt documentation uses | |||
{| class="wikitable" | {| class="wikitable" | ||
| Line 438: | Line 838: | ||
|} | |} | ||
Qt Creator and Qt Design Studio documentation uses a few more terms consistently. | |||
Qt Creator and Qt Design Studio | |||
{| class="wikitable" | {| class="wikitable" | ||
! Term !! Correct | ! Term !! Correct usage !! Context | ||
|- | |- | ||
| kit || kit (not "configuration set") || Qt Creator | | kit || kit (not "configuration set") || Qt Creator | ||
| Line 454: | Line 852: | ||
|} | |} | ||
== | == Enforcement levels == | ||
Rules have different enforcement levels. The level tells you which findings to fix first. | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 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 (<code>\brief</code> on top-level nodes), R41 (<code>\sa</code> 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 [[Qt Writing Guidelines#Checking your documentation|Checking your documentation]] if you already have a review comment to fix. | |||
[[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:
- 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 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:
- 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
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."
|
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.