path: root/src/gui/text
diff options
authorCasper van Donderen <>2012-05-07 15:50:31 +0200
committerMarius Storm-Olsen <>2012-05-09 08:36:34 +0200
commitcfdc5628b1fc2cbafa2aebca38995e5718fcb0de (patch)
tree67615dc74faa944bf7745c9db001efa3594a3249 /src/gui/text
parent3b8e6027c2f79bde70f9415f0757df073ef75702 (diff)
Doc: Modularize QtGui documentation.
This change moves the snippets and images to the modularized directories. Change-Id: I5f86f598fbe7c47d632c613b85d94ced89ba2c29 Reviewed-by: Marius Storm-Olsen <>
Diffstat (limited to 'src/gui/text')
12 files changed, 35 insertions, 35 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 161bb4e23d..cd1556070e 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -367,7 +367,7 @@ QFontEngineData::~QFontEngineData()
Create QFonts like this:
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 0
+ \snippet code/src_gui_text_qfont.cpp 0
The attributes set in the constructor can also be set later, e.g.
setFamily(), setPointSize(), setPointSizeFloat(), setWeight() and
@@ -464,11 +464,11 @@ QFontEngineData::~QFontEngineData()
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 1
+ \snippet code/src_gui_text_qfont.cpp 1
If you had both an Adobe and a Cronyx Helvetica, you might get
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 2
+ \snippet code/src_gui_text_qfont.cpp 2
You can specify the foundry you want in the family name. The font f
in the above example will be set to "Helvetica
@@ -477,11 +477,11 @@ QFontEngineData::~QFontEngineData()
To determine the attributes of the font actually used in the window
system, use a QFontInfo object, e.g.
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 3
+ \snippet code/src_gui_text_qfont.cpp 3
To find out font metrics use a QFontMetrics object, e.g.
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 4
+ \snippet code/src_gui_text_qfont.cpp 4
For more general information on fonts, see the
\link comp.fonts FAQ.\endlink
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index a1af856992..42096d9ae7 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1197,8 +1197,8 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
- \snippet doc/src/snippets/qfontdatabase/main.cpp 0
- \snippet doc/src/snippets/qfontdatabase/main.cpp 1
+ \snippet qfontdatabase/main.cpp 0
+ \snippet qfontdatabase/main.cpp 1
This example gets the list of font families, the list of
styles for each family, and the point sizes that are available for
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index fe9e1d16c7..cc6fa4bfee 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -122,7 +122,7 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
and size(), to return the size of that rectangle.
- \snippet doc/src/snippets/code/src_gui_text_qfontmetrics.cpp 0
+ \snippet code/src_gui_text_qfontmetrics.cpp 0
\sa QFont, QFontInfo, QFontDatabase, QFontComboBox, {Character Map Example}
@@ -976,7 +976,7 @@ int QFontMetrics::lineWidth() const
and size(), to return the size of that rectangle.
- \snippet doc/src/snippets/code/src_gui_text_qfontmetrics.cpp 1
+ \snippet code/src_gui_text_qfontmetrics.cpp 1
\sa QFont QFontInfo QFontDatabase
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index c6810ad61f..c372071019 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -253,7 +253,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
pass it the QTextEdit or QTextDocument that you want the syntax
highlighting to be applied to. For example:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 0
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 0
After this your highlightBlock() function will be called
automatically whenever necessary. Use your highlightBlock()
@@ -262,7 +262,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
setFormat() function which applies a given QTextCharFormat on
the current text block. For example:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 1
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 1
Some syntaxes can have constructs that span several text
blocks. For example, a C++ syntax highlighter should be able to
@@ -285,7 +285,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
For example, if you're writing a simple C++ syntax highlighter,
you might designate 1 to signify "in comment":
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 2
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 2
In the example above, we first set the current block state to
0. Then, if the previous block ended within a comment, we higlight
@@ -432,7 +432,7 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block)
setFormat() as often as necessary to apply any font and color
changes that you require. For example:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 3
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 3
Some syntaxes can have constructs that span several text
blocks. For example, a C++ syntax highlighter should be able to
@@ -602,7 +602,7 @@ void QSyntaxHighlighter::setCurrentBlockState(int newState)
and store their relative position and the actual QChar in a simple
class derived from QTextBlockUserData:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 4
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 4
During cursor navigation in the associated editor, you can ask the
current QTextBlock (retrieved using the QTextCursor::block()
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 02fd921fac..ce46ec2e59 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -972,7 +972,7 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
diacritics). Functions such as movePosition() and deleteChar()
limit cursor movement to these valid positions.
- \sa \link richtext.html Rich Text Processing\endlink
+ \sa {Rich Text Processing}
@@ -1380,7 +1380,7 @@ void QTextCursor::setKeepPositionOnInsert(bool b)
If there is a selection, the selection is deleted and replaced by
\a text, for example:
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 0
+ \snippet code/src_gui_text_qtextcursor.cpp 0
This clears any existing selection, selects the word at the cursor
(i.e. from position() forward), and replaces the selection with
the phrase "Hello World".
@@ -2301,7 +2301,7 @@ void QTextCursor::insertImage(const QTextImageFormat &format)
Convenience method for inserting the image with the given \a name at the
current position().
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 1
+ \snippet code/src_gui_text_qtextcursor.cpp 1
void QTextCursor::insertImage(const QString &name)
@@ -2445,7 +2445,7 @@ bool QTextCursor::operator>(const QTextCursor &rhs) const
For example:
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 2
+ \snippet code/src_gui_text_qtextcursor.cpp 2
The call to undo() will cause both insertions to be undone,
causing both "World" and "Hello" to be removed.
@@ -2474,7 +2474,7 @@ void QTextCursor::beginEditBlock()
For example:
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 3
+ \snippet code/src_gui_text_qtextcursor.cpp 3
The call to undo() will cause all three insertions to be undone.
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index ec660dd050..f0546566d4 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1511,7 +1511,7 @@ QTextBlock QTextDocument::begin() const
This function returns a block to test for the end of the document
while iterating over it.
- \snippet doc/src/snippets/textdocumentendsnippet.cpp 0
+ \snippet textdocumentendsnippet.cpp 0
The block returned is invalid and represents the block after the
last block in the document. You can use lastBlock() to retrieve the
@@ -1868,15 +1868,15 @@ QVariant QTextDocument::resource(int type, const QUrl &name) const
For example, you can add an image as a resource in order to reference it
from within the document:
- \snippet snippets/textdocument-resources/main.cpp Adding a resource
+ \snippet textdocument-resources/main.cpp Adding a resource
The image can be inserted into the document using the QTextCursor API:
- \snippet snippets/textdocument-resources/main.cpp Inserting an image with a cursor
+ \snippet textdocument-resources/main.cpp Inserting an image with a cursor
Alternatively, you can insert images using the HTML \c img tag:
- \snippet snippets/textdocument-resources/main.cpp Inserting an image using HTML
+ \snippet textdocument-resources/main.cpp Inserting an image using HTML
void QTextDocument::addResource(int type, const QUrl &name, const QVariant &resource)
@@ -2967,7 +2967,7 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
The \a encoding parameter specifies the value for the charset attribute
in the html header. For example if 'utf-8' is specified then the
beginning of the generated html will look like this:
- \snippet doc/src/snippets/code/src_gui_text_qtextdocument.cpp 0
+ \snippet code/src_gui_text_qtextdocument.cpp 0
If no encoding is specified then no such meta information is generated.
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index b0bbeb7a47..2894c280e8 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -160,7 +160,7 @@ QTextDocumentWriter::~QTextDocumentWriter()
Sets the format used to write documents to the \a format specified.
\a format is a case insensitive text string. For example:
- \snippet doc/src/snippets/code/src.gui.text.qtextdocumentwriter.cpp 0
+ \snippet code/src_gui_text_qtextdocumentwriter.cpp 0
You can call supportedDocumentFormats() for the full list of formats
QTextDocumentWriter supports.
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 9a38b1f0b2..bb3d897ebe 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -2269,7 +2269,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
can be used to customize the numbers used in an ordered list so that they
appear as (1), (2), (3), etc.:
- \snippet doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list
+ \snippet textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list
\sa QTextList
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 94af3edeeb..0ab964778a 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -282,10 +282,10 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
created lines.
Here is a code snippet that demonstrates the layout phase:
- \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0
+ \snippet code/src_gui_text_qtextlayout.cpp 0
The text can then be rendered by calling the layout's draw() function:
- \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 1
+ \snippet code/src_gui_text_qtextlayout.cpp 1
For a given position in the text you can find a valid cursor position with
isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition().
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index c3c71bc021..82d744d654 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -75,7 +75,7 @@ public:
The \l{QTextCursor::insertList()} function inserts an empty block into the
document at the cursor position, and makes it the first item in a list.
- \snippet doc/src/snippets/textdocument-lists/mainwindow.cpp 0
+ \snippet textdocument-lists/mainwindow.cpp 0
The \l{QTextCursor::createList()} function takes the contents of the
cursor's current block and turns it into the first item of a new list.
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index a9daf6ba56..d4e9c7d12c 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -939,8 +939,8 @@ bool QTextBlock::isValid() const
An iterator can be constructed and used to access the fragments within
a text block in the following way:
- \snippet doc/src/snippets/textblock-fragments/xmlwriter.cpp 4
- \snippet doc/src/snippets/textblock-fragments/xmlwriter.cpp 7
+ \snippet textblock-fragments/xmlwriter.cpp 4
+ \snippet textblock-fragments/xmlwriter.cpp 7
\sa QTextFragment
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 65bc8fde1e..a9866187d3 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -510,9 +510,9 @@ void QTextTablePrivate::update() const
For example, we can insert a table with three rows and two columns at the
current cursor position in an editor using the following lines of code:
- \snippet doc/src/snippets/textdocument-tables/mainwindow.cpp 1
+ \snippet textdocument-tables/mainwindow.cpp 1
- \snippet doc/src/snippets/textdocument-tables/mainwindow.cpp 3
+ \snippet textdocument-tables/mainwindow.cpp 3
The table format is either defined when the table is created or changed
later with setFormat().
@@ -545,14 +545,14 @@ void QTextTablePrivate::update() const
\li Suppose we have a 2x3 table of names and addresses. To merge both
columns in the first row we invoke mergeCells() with \a row = 0,
\a column = 0, \a numRows = 1 and \a numColumns = 2.
- \snippet doc/src/snippets/textdocument-texttable/main.cpp 0
+ \snippet textdocument-texttable/main.cpp 0
\li \inlineimage texttable-merge.png
\li This gives us the following table. To split the first row of the table
back into two cells, we invoke the splitCell() function with \a numRows
and \a numCols = 1.
- \snippet doc/src/snippets/textdocument-texttable/main.cpp 1
+ \snippet textdocument-texttable/main.cpp 1
\li \inlineimage texttable-split.png Split Table