summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-21 23:21:52 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-21 23:21:52 (GMT)
commit8b059a78b2632e31492fa25cfaae99b111a041a6 (patch)
treee30c11849ffc99ceee0c52a3951aa732db715ec0 /src/gui/text
parent7f3d9a76e9d956d9e7e4398ac20785070e214958 (diff)
parentc3eeb227360343ccb34365e384e085b358d81f21 (diff)
downloadQt-8b059a78b2632e31492fa25cfaae99b111a041a6.zip
Qt-8b059a78b2632e31492fa25cfaae99b111a041a6.tar.gz
Qt-8b059a78b2632e31492fa25cfaae99b111a041a6.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (26 commits) Fix incorrect usage of _HB_OPEN_Free_Device() in CaretValue cleanup Fix null HB_Device** dereference on exit in Harfbuzz GPOS code Doc: Relicensed the documentation under the GNU FDL version 1.3. doc: Added more DITA output to the XML generator Designer: Prevent QButtonGroup from being added for Q3ButtonGroup. Fix for a leak in the mac style. Doc: Fixing bugs to style and script doc: Added more DITA output to the XML generator Make sure that <br/> is seen as a valid tag in Qt::mightBeRichText() Fix compiler warnings in QtGui (text,painting). Allow Unix to generate unique UUIDs if /dev/urandom exists. Allow GNU Free Documentation license header. Add missing license header. Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to ab9a897b688e991a8405cf938dea9d6a2f1ac072 Fix example compile and runtime warnings, webkit examples not built. qgl_cl_p.h is no longer existent Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 5699175f55acbdfa4ac95ab6c727ebd4a201f3a2 Doc: Fixed documentation errors. doc: Added more DITA output to the XML generator doc: Fixed type of Package::name ...
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qstatictext.cpp9
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/gui/text/qtextlayout.cpp43
4 files changed, 30 insertions, 26 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index c742455..91a6612 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -421,7 +421,7 @@ namespace {
class DrawTextItemRecorder: public QPaintEngine
{
public:
- DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations, int numChars)
+ DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations)
: m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations),
m_untransformedCoordinates(untransformedCoordinates)
{
@@ -518,11 +518,10 @@ namespace {
class DrawTextItemDevice: public QPaintDevice
{
public:
- DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations,
- int numChars)
+ DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations)
{
m_paintEngine = new DrawTextItemRecorder(untransformedCoordinates,
- useBackendOptimizations, numChars);
+ useBackendOptimizations);
}
~DrawTextItemDevice()
@@ -664,7 +663,7 @@ void QStaticTextPrivate::init()
position = QPointF(0, 0);
- DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations, text.size());
+ DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations);
{
QPainter painter(&device);
painter.setFont(font);
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 48aee8f..e0386f1 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -127,6 +127,8 @@ bool Qt::mightBeRichText(const QString& text)
tag += text[i];
else if (!tag.isEmpty() && text[i].isSpace())
break;
+ else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close)
+ break;
else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
return false; // that's not a tag
}
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index ac1fffd..60195a8 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2670,7 +2670,7 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe)
: flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline),
- num_chars(0), chars(0), logClusters(0), f(font), fontEngine(fe), glyphs(g)
+ num_chars(0), chars(0), logClusters(0), f(font), glyphs(g), fontEngine(fe)
{
}
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index fec9ecc..d6535ea 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -282,12 +282,11 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
\class QTextLayout
\reentrant
- \brief The QTextLayout class is used to lay out and paint a single
- paragraph of text.
+ \brief The QTextLayout class is used to lay out and render text.
\ingroup richtext-processing
- It offers most features expected from a modern text layout
+ It offers many features expected from a modern text layout
engine, including Unicode compliant rendering, line breaking and
handling of cursor positioning. It can also produce and render
device independent layout, something that is important for WYSIWYG
@@ -297,29 +296,33 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
implement your own text rendering for some specialized widget, you
probably won't need to use it directly.
- QTextLayout can currently deal with plain text and rich text
- paragraphs that are part of a QTextDocument.
+ QTextLayout can be used with both plain and rich text.
- QTextLayout can be used to create a sequence of QTextLine's with
- given widths and can position them independently on the screen.
- Once the layout is done, these lines can be drawn on a paint
- device.
+ QTextLayout can be used to create a sequence of QTextLine
+ instances with given widths and can position them independently
+ on the screen. Once the layout is done, these lines can be drawn
+ on a paint device.
- Here's some code snippet that presents the layout phase:
+ The text to be laid out can be provided in the constructor or set with
+ setText().
+
+ The layout can be seen as a sequence of QTextLine objects; use createLine()
+ to create a QTextLine instance, and lineAt() or lineForTextPosition() to retrieve
+ created lines.
+
+ Here is a code snippet that demonstrates the layout phase:
\snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0
- The text can be drawn by calling the layout's draw() function:
+ The text can then be rendered by calling the layout's draw() function:
\snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 1
- The text layout's text is set in the constructor or with
- setText(). The layout can be seen as a sequence of QTextLine
- objects; use lineAt() or lineForTextPosition() to get a QTextLine,
- createLine() to create one. For a given position in the text you
- can find a valid cursor position with isValidCursorPosition(),
- nextCursorPosition(), and previousCursorPosition(). The layout
- itself can be positioned with setPosition(); it has a
- boundingRect(), and a minimumWidth() and a maximumWidth(). A text
- layout can be drawn on a painter device using draw().
+ For a given position in the text you can find a valid cursor position with
+ isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition().
+
+ The QTextLayout itself can be positioned with setPosition(); it has a
+ boundingRect(), and a minimumWidth() and a maximumWidth().
+
+ \sa QStaticText
*/