aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eliasson <andreas.eliasson@qt.io>2022-06-28 13:11:05 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-28 08:32:27 +0000
commite349888b5217fdeb91933ec8324c6f0497b6d465 (patch)
tree80f2cac23c2dd445434c1e2188dc8a5c18285758
parent8142a7944f7d4765cfaeddb7bf57edeed36e7b88 (diff)
Doc: Use tabs instead of a table that has code snippets6.3
Using a table with code snippets in different columns will cause the table to expand outside of the page width, forcing the user to scroll horizontally. In addition, in mobile view, the table with code snippets messes up the entire width of the page. Fixes: QTBUG-104156 Change-Id: I36341a5da162cd88961ee1f8741b166b167f8770 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io> (cherry picked from commit b6d3f84c2a2bd7bed7a85618a30e05925bc2b6c0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/doc/src/qtqml-tool-qmltc.qdoc53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/qml/doc/src/qtqml-tool-qmltc.qdoc b/src/qml/doc/src/qtqml-tool-qmltc.qdoc
index 1bdeae098c..e13d0dc0c6 100644
--- a/src/qml/doc/src/qtqml-tool-qmltc.qdoc
+++ b/src/qml/doc/src/qtqml-tool-qmltc.qdoc
@@ -123,7 +123,7 @@ Then the CMake code would usually look similar to the following:
\codeline
\snippet qmltc/CMakeLists.txt qmltc-compile-to-cpp
-\section3 Using the generated C++
+\section3 Using the Generated C++
Unlike in the case of QQmlComponent instantiation, the output of qmltc, being
C++ code, is used directly by the application. Generally, constructing a new
@@ -133,27 +133,36 @@ or, for example, combined with QQuickWindow to be drawn on screen. Given a
\c{myApp.qml} file, the application code (in both cases) would typically look
like this:
-\table 100 %
-
-\header
- \li Using QQmlComponent
- \li Using qmltc-generated class
-\row
- \li \snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-include
- \li \snippet qmltc/tst_qmltc_examples.cpp qmltc-include
-\row
- \li \snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-app-code-0
- \codeline
- \snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-app-code-1
- \codeline
- \snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-app-code-2
- \codeline
- \snippet qmltc/tst_qmltc_examples.cpp qmltc-app-exec
-
- \li \snippet qmltc/tst_qmltc_examples.cpp qmltc-app-code
- \codeline
- \snippet qmltc/tst_qmltc_examples.cpp qmltc-app-exec
-\endtable
+\if defined(onlinedocs)
+ \tab {generated-c++}{tab-qqmlcomponent}{Using QQmlComponent}{checked}
+ \tab {generated-c++}{tab-qmltc}{Using qmltc-generated class}{}
+ \tabcontent {tab-qqmlcomponent}
+\else
+ \section4 Using QQmlComponent
+\endif
+\snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-include
+\codeline
+\snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-app-code-0
+\codeline
+\snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-app-code-1
+\codeline
+\snippet qmltc/tst_qmltc_examples.cpp qqmlcomponent-app-code-2
+\codeline
+\snippet qmltc/tst_qmltc_examples.cpp qmltc-app-exec
+\if defined(onlinedocs)
+ \endtabcontent
+ \tabcontent {tab-qmltc}
+\else
+ \section4 Using qmltc-generated class
+\endif
+\snippet qmltc/tst_qmltc_examples.cpp qmltc-include
+\codeline
+\snippet qmltc/tst_qmltc_examples.cpp qmltc-app-code
+\codeline
+\snippet qmltc/tst_qmltc_examples.cpp qmltc-app-exec
+\if defined(onlinedocs)
+ \endtabcontent
+\endif
\section2 QML engine