QDoc: Add pluggable theme infrastructure with asset override mechanism
Theme authors who want to customize QDoc's template output currently
have no way to override individual assets without replacing everything.
The hardcoded stylesheet filename prevents themes from using their own
CSS, and the lack of recursive asset copy means subdirectories for
fonts or images aren't supported.
TemplateGenerator now copies assets from the template directory to the
output directory recursively, preserving subdirectory structure. When
the theme doesn't provide a particular asset, QDoc falls back to the
built-in QRC default. A configurable stylesheet name allows themes to
specify their own CSS filename, and all HTML templates use a template
variable for the stylesheet href instead of a hardcoded filename.
Relative templatedir paths resolve against the qdocconf file's
directory, consistent with how other directory keys work. The
stylesheet name must be a plain filename — path separators and
traversal are rejected.
QML type pages now show summary lists before the detailed description,
matching the established navigation order in Qt documentation where
readers scan the API surface before reading prose. Summary sections
use semantic HTML elements with ARIA labels, and member names are
bold-linked in list items matching the legacy generator's structure.
Callable members always show parentheses, preserving the visual
distinction from properties. All template variables are HTML-escaped.
A dedicated test fixture with a non-default stylesheet name validates
that the variable injection works end-to-end.
Task-number: QTBUG-145173
Change-Id: I79d4e7462cfe382f6fea5e109cf8d1c7e37a0a67
Reviewed-by: Topi Reinio <topi.reinio@qt.io>
| commit | 253cc12fbff0d2e07d6f9588238813be2148966c |
| parent | bcd474437be0a1ab157cdc93031b7a43e8de75d9 |
| author | Paul Wicking <paul.wicking@qt.io> |
| committer | Paul Wicking <paul.wicking@qt.io> |
| commit time | Tue, 24 Mar 2026 15:43:22 +0100 |
- M src/qdoc/qdoc/src/qdoc/templategenerator.cpp
- M src/qdoc/qdoc/src/qdoc/templategenerator.h
- M src/qdoc/qdoc/src/qdoc/templates/collection.html
- M src/qdoc/qdoc/src/qdoc/templates/members.html
- M src/qdoc/qdoc/src/qdoc/templates/page.html
- M src/qdoc/qdoc/src/qdoc/templates/qmltype.html
- A src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/custom_stylesheet/custom_stylesheet.qdocconf
- A src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/custom_stylesheet/expected/custom-stylesheet-test.index
- A src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/custom_stylesheet/expected/html/custom-stylesheet-test.html
- A src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/custom_stylesheet/expected/html/my-custom-theme.css
- A src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/custom_stylesheet/src/custom_stylesheet.qdoc
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/lottietoqml.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qml-item.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qml-qt-labs-lottieqt-lottieanimation-members.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qml-qt-labs-lottieqt-lottieanimation.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qml-qt-labs-lottieqt-vectorimagehelpers-layeritem.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qt-labs-lottieqt-qmlmodule.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qt-labs-lottieqt-vectorimagehelpers-qmlmodule.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qt-target-qml-from-lottie.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qtlottie-lottietoqml-example.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qtlottie-qtlottieviewer-example.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qtlottieanimation-index.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/lottietoqml.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qml-qt-labs-lottieqt-lottieanimation.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qt-labs-lottieqt-qmlmodule.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qt-labs-lottieqt-vectorimagehelpers-qmlmodule.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qt-target-qml-from-lottie.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qtlottie-lottietoqml-example.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qtlottie-qtlottieviewer-example.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qtlottieanimation-index.md