[Development] If you are working on documentation...

Martin Smith Martin.Smith at digia.com
Wed Dec 12 12:22:02 CET 2012

If you have trouble creating a link to something (usually title or subtitle) because the title or subtitle you are trying to link to exists in more than one document and your link goes to the wrong one, consider using the \target command. It didn't work across modules until today. The relevant qdoc change is integrating in stable as I write. 

Suppose you have this as a section header:

\section1 Qt Script

and you want to link to it like this:

See the section called \l {Qt Script} for more details.

This might not work because there is module page with the title Qt Script. So if you want to link to the section heading, you might get a link to the module page instead, and if you want to link to the module page, you might get a link to the section heading.

In this example, if your link goes to the wrong page, you can use the \target command. It defines a string you can link to:

\target a_unique_string
\section1 Qt Script

Then you can write:

See the section called \l {a_unique_string} for more details.

...and your link will go to the correct page. 

Never use '#' ':' or '.' in the target string, and it is a good idea not to use '-' either because qdoc replaces blanks with a '-' when it outputs the target for a title or subtitle, so the target for Qt Script become qt-script. 


More information about the Development mailing list