diff options
Diffstat (limited to 'doc/src/examples')
-rw-r--r-- | doc/src/examples/customtypesending.qdoc | 17 | ||||
-rw-r--r-- | doc/src/examples/qml-examples.qdoc | 31 |
2 files changed, 43 insertions, 5 deletions
diff --git a/doc/src/examples/customtypesending.qdoc b/doc/src/examples/customtypesending.qdoc index 2c32154..c4f262b 100644 --- a/doc/src/examples/customtypesending.qdoc +++ b/doc/src/examples/customtypesending.qdoc @@ -34,10 +34,6 @@ \image customtypesending-example.png - Contents: - - \tableofcontents - \section1 Overview In the \l{Custom Type Example}, we showed how to integrate custom types @@ -51,7 +47,7 @@ a \c Window class containing signals and slots whose signatures include \c Message arguments. - \section1 The Window Class Definition + \section1 The Window and Message Class Definitions We define a simple \c Window class with a signal and public slot that allow a \c Message object to be sent via a signal-slot connection: @@ -64,6 +60,17 @@ instance in the \c thisMessage private variable which holds the actual message to be sent. + The \c Message class is defined in the following way: + + \snippet examples/tools/customtypesending/message.h custom type definition + + The type is declared to the meta-type system with the Q_DECLARE_METATYPE() + macro: + + \snippet examples/tools/customtypesending/message.h custom type meta-type declaration + + This will make the type available for use in direct signal-slot connections. + \section1 The Window Class Implementation The \c Window constructor sets up a user interface containing a text diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 745baa3..2985e0a 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -236,6 +236,37 @@ This example shows how to enable text translation in QML. \image qml-i18n-example.png + + \section1 Introduction + + The QML runtime automatically loads a translation from the i18n subdirectory + of the root QML file, based on the system language. The translations are + held in QM files that must be generated from TS files. + + \section1 Updating Translations + + The \c{.ts} files are created and updated by running: + + \code + lupdate i18n.qml -ts i18n/base.ts + \endcode + + If no translation file exists, one will be created. If a file already exists, + it will be updated to contain the latest strings from the QML file. + + Translations for new languages are created by copying \c{i18n/base.ts} to + \c{i18n/qml_<lang>.ts} The TS files can then be edited with + \l{Qt Linguist Manual}{Qt Linguist}: + + \code + linguist i18n/qml_fr.ts + \endcode + + The run-time translation files are then generated by running: + + \code + lrelease i18n/*.ts + \endcode */ /*! |