Qt Documentation Rules: Difference between revisions
No edit summary |
No edit summary |
||
| Line 25: | Line 25: | ||
Three grammar terms set a register. Person says who the text addresses: "you" is second person, and "the function" is third person. Tense says when something happens. Mood says whether a sentence gives a command or states a fact. An '''imperative''' sentence is a command, as in "Run the application", and an '''indicative''' sentence states a fact, as in "The item ignores events". | Three grammar terms set a register. Person says who the text addresses: "you" is second person, and "the function" is third person. Tense says when something happens. Mood says whether a sentence gives a command or states a fact. An '''imperative''' sentence is a command, as in "Run the application", and an '''indicative''' sentence states a fact, as in "The item ignores events". | ||
A '''QUIP''' is a Qt Project proposal document, and S2 is the one about documentation style. 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. | A '''QUIP''' is a Qt Project proposal document, and S2 is the one about documentation style. 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. The [[#Background of the rule families|Background of the rule families]] section at the end of this page explains where each family of rules comes from. | ||
QDoc commands start with a backslash. The table lists the commands that appear most often in the rules and what each one does. | QDoc commands start with a backslash. The table lists the commands that appear most often in the rules and what each one does. | ||
| Line 909: | Line 909: | ||
| '''Recommended''' || Should be followed and is not strictly enforced || R39 (no space before a brace) | | '''Recommended''' || Should be followed and is not strictly enforced || R39 (no space before a brace) | ||
|} | |} | ||
== Background of the rule families == | |||
The rule families come from the Qt writing sources and from measurements of existing Qt documentation. A split between checks that a tool can run and checks that need a reader divides them. The sections below name the source of each family. A reviewer can use them to judge a rule that looks arbitrary, and a contributor can use them to find what to cite when proposing a change. | |||
The rule text is maintained in the [https://code.qt.io/cgit/qt/qtqa.git/tree/doc_agent_framework?h=dev doc_agent_framework folder] of the qtqa repository, and that text is authoritative. This wiki page describes the rules and reflects the repository. When the two differ, the repository is correct, and the wiki page needs an update. | |||
=== Sources and tool-checkable rules === | |||
The S sources are the written authorities, and every other rule traces back to one of them. [https://code.qt.io/cgit/meta/quips.git/plain/quip-0025-Documentation-Writing-Style.rst QUIP 25], the [[Qt Writing Guidelines]], and the C++ and QML documentation style pages rank highest. The [https://learn.microsoft.com/en-us/style-guide/welcome/ Microsoft Writing Style Guide] fills gaps that the Qt sources leave open. The Sources table above gives the order for resolving a conflict. | |||
The R rules restate the concrete statements of those sources. The original list, R1 to R64, is in the [https://code.qt.io/cgit/qt/qtqa.git/tree/documentation_review/skills/skill-language-style?h=dev skill-language-style folder] of qtqa. A rule is an R rule only when a tool can decide it: a Vale rule, a QDoc warning message, a pattern search, or a short script. To run the Vale rules, see [[Setting Up Vale]]. | |||
The wiki and the Vale configuration share the same IDs, so a linter message and a review comment cite the same number. The Gerrit change [https://codereview.qt-project.org/c/qt/qtqa/+/774265 vale: group Qt rules under styles/Qt by language, structure, and mechanics] sorts the Vale rules by the R rule that each one checks. Gerrit is the Qt code review system, and the change shows the review history of that work. | |||
=== Judgment rules === | |||
The G rules hold the parts of a source that no tool can decide, such as whether a sentence is clear or whether a brief names the right subject. A reviewer applies them, and a Vale rule may only shortlist candidates. G1 to G22 come from splitting the original R list by one test. A rule with a reliable tool check stays an R rule, and a rule that needs a reader's judgment becomes a G rule. Each G rule names the R rule it grew from. | |||
A review of the Qt sources then looked for statements that no rule covered. It examined 123 prescriptive statements in the Qt Writing Guidelines and the C++, QML, example, terminology, and alt text pages. Of these, 26 were covered by a rule, 42 were covered in part, and 55 were not covered. QUIP 25 was not part of that review. The gaps became candidates for new R and G rules. | |||
G31 and G34 cover titles and paragraphs. The Qt Writing Guidelines give no rule on topic sentences or paragraph length. These two rules take their principle from the Microsoft Writing Style Guide pages on leading with the main point and keeping paragraphs short. Their targets come from the measurements below. | |||
=== Measurements of Qt documentation === | |||
Three counts over Qt documentation support the rules. Each was run on the Qt sources, and the scripts are not in the repository, so the figures are approximate and a contributor cannot rerun them yet. | |||
* A count of topic commands, such as <code>\class</code>, <code>\qmltype</code>, and <code>\page</code>, across the Qt sources. It gave the detection rules for the content types. | |||
* A count of paragraphs in the <code>.qdoc</code> pages: 23,202 paragraphs, with a median of 21 words and one sentence, and a 90th percentile of 57 words and three sentences. The G34 limit of one to three sentences follows these figures. | |||
* A count of headings: 12,623 lines that set a <code>\title</code> or a <code>\section1</code> to <code>\section4</code> title, in qtbase, qtdeclarative, qtdoc, qtquick3d, qtmultimedia, and qttools. It informed G31. | |||
A fourth count, of register markers, is described under Registers. | |||
=== Origin of the content types === | |||
The C rules sort documentation into types, because a rule that suits one type can be wrong for another. The topic-command count gave the detection rules. For example, <code>\class</code> marks a C++ class page, <code>\qmltype</code> marks a QML type page, and a <code>\page</code> command marks a page that is told apart by its name. A topic command is the command that opens a documentation block for one thing. | |||
Each type page in qtqa lists the rules that apply to it, the exemptions, and a short passing sample. The detection has a known gap: a legal page written with <code>\page</code> falls through to the overview type. See [[#Content types|Content types]] above for the types themselves. | |||
=== Origin of the registers === | |||
A register is the way a type of text sounds: its person, tense, mood, and sentence length. See [[#Registers|Registers]] above for the rules. The term comes from linguistics, and topic-based authoring approaches such as DITA, the Darwin Information Typing Architecture, also hold that concept, task, and reference topics each want their own voice. The framework treats these as background and does not derive its registers from either source. | |||
The first register set was measured against Qt text. A count of register markers per 1,000 words over about 3 million words of Qt documentation showed three things: | |||
* Reference pages use "you" 2 to 4 times per 1,000 words, so a ban on "you" in reference text was too strict. | |||
* Example pages use the inclusive "we" about 30 times as often as C++ class pages. This describes existing practice, and G24 still lists "we" as incorrect in new text. | |||
* Module and porting pages use promotional words about 6 times as often as C++ class pages. These counts are proxies, and a high rate says where to look, not that the text is wrong. | |||
The essay, marketing, and conversational registers stay in the list because they are the normal voice of the Qt blog, the product pages, and the forum. Each of them states where it is expected, where it is limited, and where it is a finding. | |||
The settings of each register, such as sentence length and the allowed pronouns, are kept as values that a script checks. They are in the [https://code.qt.io/cgit/qt/qtqa.git/tree/doc_agent_framework/skills/skill-g-rules/references/register-dials.toml?h=dev register settings file], and the script is in the [https://code.qt.io/cgit/qt/qtqa.git/tree/doc_agent_framework/tools/register-dials?h=dev register-dials folder]. Most values there are initial values with no S source. | |||
=== Maintenance of the rule text === | |||
To propose a rule change, push a change to the qtqa repository on [https://codereview.qt-project.org/ Qt Code Review] and cite the source that supports it. The change that added the language rule skills is [https://codereview.qt-project.org/q/Ia56e124baf31105ebf0c501aac7c7bc914409650 Doc Agent Framework: Add language rule skills]. Once the change merges, update this page to match. | |||
=== Limits === | |||
The figures in this section come from counts over the Qt sources and are approximate. The rule set is provisional, and IDs may change before the Documentation Team approves the numbering. | |||
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. | 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]] | ||
Latest revision as of 12:49, 1 December 2026
Work in progress: The rules are based on official sources, the QUIPs and the Qt writing guides. However, the rule set is changing. It comes 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, such as a Vale rule, a QDoc warning, or a short script, so the same text always gets the same result | R12 is sentence-case titles |
| G | A rule that needs understanding, so a person reads the text and decides | 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. You can download the rules yourself from the qtqa repository. The Vale rules are in the Qt style folder. The text files of the rule set are in the rules folder.
If you write a new page, start with its content type and its register. The content type is the kind of page, such as a class reference, a tutorial, or an overview, and the Content types section shows how to find it. The register is the way that kind of text sounds, and the Registers section describes each one. Then apply the rules that fit the type, beginning with R14 and R15 for the brief, R12 for titles, and G31 and G34 for titles and paragraphs.
Three grammar terms set a register. Person says who the text addresses: "you" is second person, and "the function" is third person. Tense says when something happens. Mood says whether a sentence gives a command or states a fact. An imperative sentence is a command, as in "Run the application", and an indicative sentence states a fact, as in "The item ignores events".
A QUIP is a Qt Project proposal document, and S2 is the one about documentation style. 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. The Background of the rule families section at the end of this page explains where each family of rules comes from.
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 index of content types is in the C rules file in the qtqa repository.
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 |
| C13 | Qt Blog post | Not detected or reviewed yet | G26 (expected) |
| C14 | qt.io product page | Not detected or reviewed yet | G27 (expected) |
| C15 | Qt Forum post | Not detected or reviewed yet | G30 (expected) |
| 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 |
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. The text of the register rules G23 to G30 is in the registers file in the qtqa repository.
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 C++ API reference and QML API reference pages, and for the reference pages of the Qt Creator and Qt Design Studio documentation and of the Qt Framework development tools. 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. The table shows three incorrect sentences and their corrections.
| Incorrect | Correct |
|---|---|
| You can use this function to get the size of the list. | Returns the number of items in the list. |
| Be careful: this function might give you a null pointer. | Returns \c nullptr if no item exists at \a index.
|
| This property is where you set whether the button is enabled. | This property holds whether the button is enabled. |
G24: Tutorial register
Used for tutorial and getting started pages and for platform and deployment pages. It also serves example walkthroughs, porting steps, and the usage pages of the Qt Creator and Qt Design Studio documentation and of the Qt Framework development tools. The text walks the reader through steps in order, with "you" and imperative sentences. State the result instead of giving reassurance. The table shows three incorrect sentences and their corrections.
| Incorrect | Correct |
|---|---|
| Don't worry, you should see a window appear. | Run the application. A window opens. |
| The next step is for the project to be built by clicking the Build button. | Click \uicontrol Build to build the project.
|
| Now we'll add a button to the window. | Add a button to the window. |
G25: Conceptual register
Used for module pages, overview and concept pages, commit messages, and reports and proposals. It also serves example descriptions and the explanations on platform and deployment pages and on porting, changes, and what's new pages. 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. The table shows three incorrect sentences and their corrections: an API fact, a list of steps, and an analogy used as the definition.
| Incorrect | Correct |
|---|---|
The connect() function takes five parameters. |
Signals and slots let objects communicate without knowing which objects receive the signal. |
First create a timer, then call start(), then connect its timeout() signal. |
A timer emits a signal at a regular interval, so an object can act on a schedule without checking the clock itself. |
| The model is like a kitchen, the view is the waiter, and the delegate is the menu. | The model holds the data, and the view displays it. The delegate controls how the view draws each item. |
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 API reference, module, example, tutorial, platform, porting, and tools documentation pages it is a finding. The table shows three incorrect sentences and their corrections.
| 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. |
| Why do so many applications freeze? Because nobody moves work off the main thread. | Long-running work in the main thread blocks the event loop, so the user interface stops responding. |
| Callbacks are the past, and signals and slots are the future. | Signals and slots connect an event to a response without the sender knowing the receiver. |
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. The table shows three incorrect sentences and their corrections.
| Incorrect | Correct |
|---|---|
| Build stunning apps faster than ever, with one codebase for every screen. | Qt Quick applications run on desktop, mobile, and embedded platforms. |
| The most powerful, blazing fast rendering engine ever! | The Qt Quick scene graph renders items with the GPU. |
| Never worry about deployment again! | The deployment tool collects the libraries and plugins that an application needs. |
G28: Legal register
Used for legal and license text. It defines obligations, so "shall" and "must" are allowed. Review Qt-authored \legalese notices only, and never rewrite third-party license text. The table shows three incorrect sentences and their corrections. The sentences illustrate the register and are not license text.
| Incorrect | Correct |
|---|---|
| You can use this code, but you have to keep our name on it. | The Licensee must retain the copyright notice in all copies of the Software. |
| Qt is provided as is, so do not blame us if it breaks. | The Software is provided "as is", without warranty of any kind. |
| You should probably ask us before you sell it. | The Licensee shall obtain written permission before it distributes the Software. |
G29: Release notes register
Used for change lists on porting, changes, and what's new pages. 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. The table shows three incorrect sentences and their corrections.
| Incorrect | Correct |
|---|---|
| We have gone ahead and removed the old API. | Removed QFoo::oldValue(). Use QFoo::value() instead.
|
| A bug where the dialog crashed on close has been fixed. | Fixed a crash when the dialog closes. |
| The new signal is added so you can find out when the value changes. | Added the valueChanged() signal.
|
G30: Conversational register
Used for forum posts, chat, and code review comments. It allows filler, loose grammar, and the first person singular. In pages on doc.qt.io 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. The table shows three incorrect sentences and their corrections for a page on doc.qt.io.
| Incorrect | Correct |
|---|---|
| So, to use the model, set it on the view. | To use the model, set it on the view. |
I think you would want to call update() here, or whatever. |
The update() function schedules a repaint.
|
| Yeah, that method is deprecated now, so just use the new one. | This function is deprecated. Use value() instead.
|
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 index of these rules and their checks is in the R rules file in the qtqa repository.
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. Save images in WebP format when possible, for a smaller file size (QUIP 21, S8) |
| 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. The text of rules G1 to G22 is in the G rules file in the qtqa repository.
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) |
Background of the rule families
The rule families come from the Qt writing sources and from measurements of existing Qt documentation. A split between checks that a tool can run and checks that need a reader divides them. The sections below name the source of each family. A reviewer can use them to judge a rule that looks arbitrary, and a contributor can use them to find what to cite when proposing a change.
The rule text is maintained in the doc_agent_framework folder of the qtqa repository, and that text is authoritative. This wiki page describes the rules and reflects the repository. When the two differ, the repository is correct, and the wiki page needs an update.
Sources and tool-checkable rules
The S sources are the written authorities, and every other rule traces back to one of them. QUIP 25, the Qt Writing Guidelines, and the C++ and QML documentation style pages rank highest. The Microsoft Writing Style Guide fills gaps that the Qt sources leave open. The Sources table above gives the order for resolving a conflict.
The R rules restate the concrete statements of those sources. The original list, R1 to R64, is in the skill-language-style folder of qtqa. A rule is an R rule only when a tool can decide it: a Vale rule, a QDoc warning message, a pattern search, or a short script. To run the Vale rules, see Setting Up Vale.
The wiki and the Vale configuration share the same IDs, so a linter message and a review comment cite the same number. The Gerrit change vale: group Qt rules under styles/Qt by language, structure, and mechanics sorts the Vale rules by the R rule that each one checks. Gerrit is the Qt code review system, and the change shows the review history of that work.
Judgment rules
The G rules hold the parts of a source that no tool can decide, such as whether a sentence is clear or whether a brief names the right subject. A reviewer applies them, and a Vale rule may only shortlist candidates. G1 to G22 come from splitting the original R list by one test. A rule with a reliable tool check stays an R rule, and a rule that needs a reader's judgment becomes a G rule. Each G rule names the R rule it grew from.
A review of the Qt sources then looked for statements that no rule covered. It examined 123 prescriptive statements in the Qt Writing Guidelines and the C++, QML, example, terminology, and alt text pages. Of these, 26 were covered by a rule, 42 were covered in part, and 55 were not covered. QUIP 25 was not part of that review. The gaps became candidates for new R and G rules.
G31 and G34 cover titles and paragraphs. The Qt Writing Guidelines give no rule on topic sentences or paragraph length. These two rules take their principle from the Microsoft Writing Style Guide pages on leading with the main point and keeping paragraphs short. Their targets come from the measurements below.
Measurements of Qt documentation
Three counts over Qt documentation support the rules. Each was run on the Qt sources, and the scripts are not in the repository, so the figures are approximate and a contributor cannot rerun them yet.
- A count of topic commands, such as
\class,\qmltype, and\page, across the Qt sources. It gave the detection rules for the content types. - A count of paragraphs in the
.qdocpages: 23,202 paragraphs, with a median of 21 words and one sentence, and a 90th percentile of 57 words and three sentences. The G34 limit of one to three sentences follows these figures. - A count of headings: 12,623 lines that set a
\titleor a\section1to\section4title, in qtbase, qtdeclarative, qtdoc, qtquick3d, qtmultimedia, and qttools. It informed G31.
A fourth count, of register markers, is described under Registers.
Origin of the content types
The C rules sort documentation into types, because a rule that suits one type can be wrong for another. The topic-command count gave the detection rules. For example, \class marks a C++ class page, \qmltype marks a QML type page, and a \page command marks a page that is told apart by its name. A topic command is the command that opens a documentation block for one thing.
Each type page in qtqa lists the rules that apply to it, the exemptions, and a short passing sample. The detection has a known gap: a legal page written with \page falls through to the overview type. See Content types above for the types themselves.
Origin of the registers
A register is the way a type of text sounds: its person, tense, mood, and sentence length. See Registers above for the rules. The term comes from linguistics, and topic-based authoring approaches such as DITA, the Darwin Information Typing Architecture, also hold that concept, task, and reference topics each want their own voice. The framework treats these as background and does not derive its registers from either source.
The first register set was measured against Qt text. A count of register markers per 1,000 words over about 3 million words of Qt documentation showed three things:
- Reference pages use "you" 2 to 4 times per 1,000 words, so a ban on "you" in reference text was too strict.
- Example pages use the inclusive "we" about 30 times as often as C++ class pages. This describes existing practice, and G24 still lists "we" as incorrect in new text.
- Module and porting pages use promotional words about 6 times as often as C++ class pages. These counts are proxies, and a high rate says where to look, not that the text is wrong.
The essay, marketing, and conversational registers stay in the list because they are the normal voice of the Qt blog, the product pages, and the forum. Each of them states where it is expected, where it is limited, and where it is a finding.
The settings of each register, such as sentence length and the allowed pronouns, are kept as values that a script checks. They are in the register settings file, and the script is in the register-dials folder. Most values there are initial values with no S source.
Maintenance of the rule text
To propose a rule change, push a change to the qtqa repository on Qt Code Review and cite the source that supports it. The change that added the language rule skills is Doc Agent Framework: Add language rule skills. Once the change merges, update this page to match.
Limits
The figures in this section come from counts over the Qt sources and are approximate. The rule set is provisional, and IDs may change before the Documentation Team approves the numbering.
For the next step, read the Qt Writing Guidelines, or its section Checking your documentation if you already have a review comment to fix.