summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp21
-rw-r--r--src/gui/text/qcssparser_p.h16
-rw-r--r--src/gui/text/qfont.cpp9
-rw-r--r--src/gui/text/qfontdatabase.cpp6
-rw-r--r--src/gui/text/qfontmetrics.cpp21
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
-rw-r--r--src/gui/text/qtextcontrol.cpp2
-rw-r--r--src/gui/text/qtextcursor.cpp9
-rw-r--r--src/gui/text/qtextdocument.cpp4
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp23
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp57
-rw-r--r--src/gui/text/qtexthtmlparser.cpp5
-rw-r--r--src/gui/text/qtextlayout.cpp6
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtextobject.cpp26
-rw-r--r--src/gui/text/qtextobject_p.h2
-rw-r--r--src/gui/text/qtextoption.cpp2
-rw-r--r--src/gui/text/qtexttable.cpp4
-rw-r--r--src/gui/text/qtexttable_p.h2
-rw-r--r--src/gui/text/qzip.cpp2
-rw-r--r--src/gui/text/text.pri2
24 files changed, 105 insertions, 124 deletions
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 8b21c8f..f2ddeb6 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
\brief The QAbstractTextDocumentLayout class is an abstract base
class used to implement custom layouts for QTextDocuments.
- \ingroup text
+ \ingroup richtext-processing
The standard layout provided by Qt can handle simple word processing
including inline images, lists and tables.
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 7f9cd9d..fcc26d6 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -383,10 +383,7 @@ LengthData ValueExtractor::lengthValue(const Value& v)
if (data.unit != LengthData::None)
s.chop(2);
- bool ok;
- data.number = s.toDouble(&ok);
- if (!ok)
- data.number = 0;
+ data.number = s.toDouble();
return data;
}
@@ -712,7 +709,7 @@ static ColorData parseColorValue(Value v)
for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) {
if (colorDigits.at(i).type == Value::Percentage) {
- colorDigits[i].variant = colorDigits.at(i).variant.toDouble() * 255. / 100.;
+ colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.);
colorDigits[i].type = Value::Number;
} else if (colorDigits.at(i).type != Value::Number) {
return ColorData();
@@ -789,19 +786,19 @@ static BrushData parseBrushValue(const Value &v, const QPalette &pal)
ColorData cd = parseColorValue(color);
if(cd.type == ColorData::Role)
dependsOnThePalette = true;
- stops.append(QGradientStop(stop.variant.toDouble(), colorFromData(cd, pal)));
+ stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal)));
} else {
parser.next();
Value value;
- parser.parseTerm(&value);
+ (void)parser.parseTerm(&value);
if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) {
spread = spreads.indexOf(value.variant.toString());
} else {
- vars[attr] = value.variant.toString().toDouble();
+ vars[attr] = value.variant.toReal();
}
}
parser.skipSpace();
- parser.test(COMMA);
+ (void)parser.test(COMMA);
}
if (gradType == 0) {
@@ -1080,8 +1077,8 @@ static bool setFontSizeFromValue(Value value, QFont *font, int *fontSizeAdjustme
if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)) {
s.chop(2);
value.variant = s;
- if (value.variant.convert(QVariant::Double)) {
- font->setPointSizeF(value.variant.toDouble());
+ if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) {
+ font->setPointSizeF(value.variant.toReal());
valid = true;
}
} else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
@@ -2462,7 +2459,7 @@ bool Parser::parseAttrib(AttributeSelector *attr)
bool Parser::parsePseudo(Pseudo *pseudo)
{
- test(COLON);
+ (void)test(COLON);
pseudo->negated = test(EXCLAMATION_SYM);
if (test(IDENT)) {
pseudo->name = lexem();
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 2d21bc2..6f73445 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -368,18 +368,18 @@ struct Q_GUI_EXPORT Value
};
struct ColorData {
- ColorData() : type(Invalid) {}
- ColorData(const QColor &col) : color(col) , type(Color) {}
- ColorData(QPalette::ColorRole r) : role(r) , type(Role) {}
+ ColorData() : role(QPalette::NoRole), type(Invalid) {}
+ ColorData(const QColor &col) : color(col), role(QPalette::NoRole), type(Color) {}
+ ColorData(QPalette::ColorRole r) : role(r), type(Role) {}
QColor color;
QPalette::ColorRole role;
enum { Invalid, Color, Role} type;
};
struct BrushData {
- BrushData() : type(Invalid) {}
- BrushData(const QBrush &br) : brush(br) , type(Brush) {}
- BrushData(QPalette::ColorRole r) : role(r) , type(Role) {}
+ BrushData() : role(QPalette::NoRole), type(Invalid) {}
+ BrushData(const QBrush &br) : brush(br), role(QPalette::NoRole), type(Brush) {}
+ BrushData(QPalette::ColorRole r) : role(r), type(Role) {}
QBrush brush;
QPalette::ColorRole role;
enum { Invalid, Brush, Role, DependsOnThePalette } type;
@@ -504,7 +504,7 @@ const int NumPseudos = 46;
struct Pseudo
{
- Pseudo() : negated(false) { }
+ Pseudo() : type(0), negated(false) { }
quint64 type;
QString name;
QString function;
@@ -726,7 +726,7 @@ enum TokenType {
struct Q_GUI_EXPORT Symbol
{
- inline Symbol() : start(0), len(-1) {}
+ inline Symbol() : token(NONE), start(0), len(-1) {}
TokenType token;
QString text;
int start, len;
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index af382cb..96905d0 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -415,11 +415,11 @@ QFontEngineData::~QFontEngineData()
\brief The QFont class specifies a font used for drawing text.
- \ingroup multimedia
+ \ingroup painting
\ingroup appearance
\ingroup shared
- \ingroup text
- \mainclass
+ \ingroup richtext-processing
+
When you create a QFont object you specify various attributes that
you want the font to have. Qt will use the font with the specified
@@ -2276,9 +2276,8 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
\brief The QFontInfo class provides general information about fonts.
- \ingroup multimedia
+ \ingroup appearance
\ingroup shared
- \ingroup text
The QFontInfo class provides the same access functions as QFont,
e.g. family(), pointSize(), italic(), weight(), fixedPitch(),
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 1f9e8d7..a8513ce 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1461,9 +1461,7 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
\brief The QFontDatabase class provides information about the fonts available in the underlying window system.
- \ingroup environment
- \ingroup multimedia
- \ingroup text
+ \ingroup appearance
The most common uses of this class are to query the database for
the list of font families() and for the pointSizes() and styles()
@@ -2602,7 +2600,7 @@ QStringList QFontDatabase::applicationFontFamilies(int id)
means that all QPainter::drawText() calls outside the GUI thread
will not produce readable output.
- \sa threads.html#painting-in-threads
+ \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads}
*/
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 5b47772..c828c9e 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -75,9 +75,8 @@ extern int qt_defaultDpi();
\brief The QFontMetrics class provides font metrics information.
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
- \ingroup text
QFontMetrics functions calculate the size of characters and
strings for a given font. There are three ways you can create a
@@ -859,24 +858,23 @@ QRect QFontMetrics::tightBoundingRect(const QString &text) const
right-to-left layouts, and on the left side for right-to-left
layouts. Note that this behavior is independent of the text
language.
-
*/
-QString QFontMetrics::elidedText(const QString &_text, Qt::TextElideMode mode, int width, int flags) const
+QString QFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const
{
- QString text = _text;
+ QString _text = text;
if (!(flags & Qt::TextLongestVariant)) {
int posA = 0;
- int posB = text.indexOf(QLatin1Char('\x9c'));
+ int posB = _text.indexOf(QLatin1Char('\x9c'));
while (posB >= 0) {
- QString portion = text.mid(posA, posB - posA);
+ QString portion = _text.mid(posA, posB - posA);
if (size(flags, portion).width() <= width)
return portion;
posA = posB + 1;
- posB = text.indexOf(QLatin1Char('\x9c'), posA);
+ posB = _text.indexOf(QLatin1Char('\x9c'), posA);
}
- text = text.mid(posA);
+ _text = _text.mid(posA);
}
- QStackTextEngine engine(text, QFont(d));
+ QStackTextEngine engine(_text, QFont(d));
return engine.elidedText(mode, width, flags);
}
@@ -942,9 +940,8 @@ int QFontMetrics::lineWidth() const
\brief The QFontMetricsF class provides font metrics information.
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
- \ingroup text
QFontMetricsF functions calculate the size of characters and
strings for a given font. You can construct a QFontMetricsF object
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 5c54500..cdb30ef 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -219,7 +219,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(QTextBlock block)
\since 4.1
- \ingroup text
+ \ingroup richtext-processing
The QSyntaxHighlighter class is a base class for implementing
QTextEdit syntax highlighters. A syntax highligher automatically
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 384e283..da09ee1 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -2288,7 +2288,7 @@ void QTextControl::print(QPrinter *printer) const
{
#ifndef QT_NO_PRINTER
Q_D(const QTextControl);
- if (printer && !printer->isValid())
+ if (!printer || !printer->isValid())
return;
QTextDocument *tempDoc = 0;
const QTextDocument *doc = d->doc;
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 6ab89dc..88ab9d0 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -84,8 +84,7 @@ QTextCursorPrivate::QTextCursorPrivate(const QTextCursorPrivate &rhs)
QTextCursorPrivate::~QTextCursorPrivate()
{
- if (priv)
- priv->removeCursor(this);
+ priv->removeCursor(this);
}
QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int positionOfChange, int charsAddedOrRemoved, QTextUndoCommand::Operation op)
@@ -125,7 +124,7 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position
void QTextCursorPrivate::setX()
{
- if (priv && priv->isInEditBlock()) {
+ if (priv->isInEditBlock()) {
x = -1; // mark dirty
return;
}
@@ -855,9 +854,9 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
\brief The QTextCursor class offers an API to access and modify QTextDocuments.
- \ingroup text
+ \ingroup richtext-processing
\ingroup shared
- \mainclass
+
Text cursors are objects that are used to access and modify the contents
and underlying structure of text documents via a programming interface
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 6fa3e90..bfed368 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -247,8 +247,8 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba)
\brief The QTextDocument class holds formatted text that can be
viewed and edited using a QTextEdit.
- \ingroup text
- \mainclass
+ \ingroup richtext-processing
+
QTextDocument is a container for structured rich text documents, providing
support for styled text and various types of document elements, such as
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index da7025c..953e965 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -259,7 +259,7 @@ void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const
\brief The QTextDocumentFragment class represents a piece of formatted text
from a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
\ingroup shared
A QTextDocumentFragment is a fragment of rich text, that can be inserted into
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index cfec8e9..a795c1f 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -198,8 +198,8 @@ public:
if (v.isNull()) {
return cellPadding;
} else {
- Q_ASSERT(v.type() == QVariant::Double);
- return QFixed::fromReal(v.toDouble() * deviceScale);
+ Q_ASSERT(v.userType() == QVariant::Double || v.userType() == QMetaType::Float);
+ return QFixed::fromReal(v.toReal() * deviceScale);
}
}
@@ -2601,13 +2601,13 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
// float has been added in the meantime, redo
layoutStruct->pendingFloats.clear();
- if (haveWordOrAnyWrapMode) {
- option.setWrapMode(QTextOption::WrapAnywhere);
- tl->setTextOption(option);
- }
-
line.setLineWidth((right-left).toReal());
if (QFixed::fromReal(line.naturalTextWidth()) > right-left) {
+ if (haveWordOrAnyWrapMode) {
+ option.setWrapMode(QTextOption::WrapAnywhere);
+ tl->setTextOption(option);
+ }
+
layoutStruct->pendingFloats.clear();
// lines min width more than what we have
layoutStruct->y = findY(layoutStruct->y, layoutStruct, QFixed::fromReal(line.naturalTextWidth()));
@@ -2619,12 +2619,13 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
else
right -= text_indent;
line.setLineWidth(qMax<qreal>(line.naturalTextWidth(), (right-left).toReal()));
- }
- if (haveWordOrAnyWrapMode) {
- option.setWrapMode(QTextOption::WordWrap);
- tl->setTextOption(option);
+ if (haveWordOrAnyWrapMode) {
+ option.setWrapMode(QTextOption::WordWrap);
+ tl->setTextOption(option);
+ }
}
+
}
QFixed lineHeight = QFixed::fromReal(line.height());
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index 33a5018..bdb5247 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -76,7 +76,7 @@ public:
\brief The QTextDocumentWriter class provides a format-independent interface for writing a QTextDocument to files or other devices.
- \ingroup text
+ \ingroup richtext-processing
\ingroup io
To write a document, construct a QTextDocumentWriter object with either a
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 82c81ef..6a77fa5 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
\brief The QTextLength class encapsulates the different types of length
used in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
When we specify a value for the length of an element in a text document,
we often need to provide some other information so that the length is
@@ -267,10 +267,11 @@ private:
static uint variantHash(const QVariant &variant)
{
- switch (variant.type()) {
+ switch (variant.userType()) {
case QVariant::Invalid: return 0;
case QVariant::Bool: return variant.toBool();
case QVariant::Int: return variant.toInt();
+ case QMetaType::Float: return static_cast<int>(variant.toFloat());
case QVariant::Double: return static_cast<int>(variant.toDouble());
case QVariant::String: return qHash(variant.toString());
case QVariant::Color: return qHash(qvariant_cast<QColor>(variant).rgb());
@@ -325,7 +326,7 @@ void QTextFormatPrivate::recalcFont() const
f.setFamily(props.at(i).value.toString());
break;
case QTextFormat::FontPointSize:
- f.setPointSizeF(props.at(i).value.toDouble());
+ f.setPointSizeF(props.at(i).value.toReal());
break;
case QTextFormat::FontPixelSize:
f.setPixelSize(props.at(i).value.toInt());
@@ -352,10 +353,10 @@ void QTextFormatPrivate::recalcFont() const
f.setStrikeOut(props.at(i).value.toBool());
break;
case QTextFormat::FontLetterSpacing:
- f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toDouble());
+ f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toReal());
break;
case QTextFormat::FontWordSpacing:
- f.setWordSpacing(props.at(i).value.toDouble());
+ f.setWordSpacing(props.at(i).value.toReal());
break;
case QTextFormat::FontCapitalization:
f.setCapitalization(static_cast<QFont::Capitalization> (props.at(i).value.toInt()));
@@ -414,7 +415,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\brief The QTextFormat class provides formatting information for a
QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
\ingroup shared
A QTextFormat is a generic class used for describing the format of
@@ -447,7 +448,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
associate the format with a QTextObject. It is used to represent
lists, frames, and tables inside the document.
- \sa {Text Processing Classes}
+ \sa {Rich Text Processing}
*/
/*!
@@ -852,7 +853,7 @@ bool QTextFormat::boolProperty(int propertyId) const
if (!d)
return false;
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Bool)
+ if (prop.userType() != QVariant::Bool)
return false;
return prop.toBool();
}
@@ -868,7 +869,7 @@ int QTextFormat::intProperty(int propertyId) const
if (!d)
return 0;
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Int)
+ if (prop.userType() != QVariant::Int)
return 0;
return prop.toInt();
}
@@ -885,7 +886,7 @@ qreal QTextFormat::doubleProperty(int propertyId) const
if (!d)
return 0.;
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Double && prop.type() != QMetaType::Float)
+ if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float)
return 0.;
return qVariantValue<qreal>(prop);
}
@@ -902,7 +903,7 @@ QString QTextFormat::stringProperty(int propertyId) const
if (!d)
return QString();
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::String)
+ if (prop.userType() != QVariant::String)
return QString();
return prop.toString();
}
@@ -920,7 +921,7 @@ QColor QTextFormat::colorProperty(int propertyId) const
if (!d)
return QColor();
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Color)
+ if (prop.userType() != QVariant::Color)
return QColor();
return qvariant_cast<QColor>(prop);
}
@@ -937,7 +938,7 @@ QPen QTextFormat::penProperty(int propertyId) const
if (!d)
return QPen(Qt::NoPen);
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Pen)
+ if (prop.userType() != QVariant::Pen)
return QPen(Qt::NoPen);
return qvariant_cast<QPen>(prop);
}
@@ -954,7 +955,7 @@ QBrush QTextFormat::brushProperty(int propertyId) const
if (!d)
return QBrush(Qt::NoBrush);
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Brush)
+ if (prop.userType() != QVariant::Brush)
return QBrush(Qt::NoBrush);
return qvariant_cast<QBrush>(prop);
}
@@ -984,13 +985,13 @@ QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
if (!d)
return vector;
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::List)
+ if (prop.userType() != QVariant::List)
return vector;
QList<QVariant> propertyList = prop.toList();
for (int i=0; i<propertyList.size(); ++i) {
QVariant var = propertyList.at(i);
- if (var.type() == QVariant::TextLength)
+ if (var.userType() == QVariant::TextLength)
vector.append(qvariant_cast<QTextLength>(var));
}
@@ -1078,7 +1079,7 @@ int QTextFormat::objectIndex() const
if (!d)
return -1;
const QVariant prop = d->property(ObjectIndex);
- if (prop.type() != QVariant::Int) // ####
+ if (prop.userType() != QVariant::Int) // ####
return -1;
return prop.toInt();
}
@@ -1183,7 +1184,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\brief The QTextCharFormat class provides formatting information for
characters in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
The character format of text in a document specifies the visual properties
of the text, as well as information about its role in a hypertext document.
@@ -1654,9 +1655,9 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
QString QTextCharFormat::anchorName() const
{
QVariant prop = property(AnchorName);
- if (prop.type() == QVariant::StringList)
+ if (prop.userType() == QVariant::StringList)
return prop.toStringList().value(0);
- else if (prop.type() != QVariant::String)
+ else if (prop.userType() != QVariant::String)
return QString();
return prop.toString();
}
@@ -1672,9 +1673,9 @@ QString QTextCharFormat::anchorName() const
QStringList QTextCharFormat::anchorNames() const
{
QVariant prop = property(AnchorName);
- if (prop.type() == QVariant::StringList)
+ if (prop.userType() == QVariant::StringList)
return prop.toStringList();
- else if (prop.type() != QVariant::String)
+ else if (prop.userType() != QVariant::String)
return QStringList();
return QStringList(prop.toString());
}
@@ -1796,7 +1797,7 @@ QFont QTextCharFormat::font() const
\brief The QTextBlockFormat class provides formatting information for
blocks of text in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A document is composed of a list of blocks, represented by QTextBlock
objects. Each block can contain an item of some kind, such as a
@@ -2087,7 +2088,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
\brief The QTextListFormat class provides formatting information for
lists in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A list is composed of one or more items, represented as text blocks.
The list's format specifies the appearance of items in the list.
@@ -2197,7 +2198,7 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\brief The QTextFrameFormat class provides formatting information for
frames in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A text frame groups together one or more blocks of text, providing a layer
of structure larger than the paragraph. The format of a frame specifies
@@ -2523,7 +2524,7 @@ qreal QTextFrameFormat::rightMargin() const
\brief The QTextTableFormat class provides formatting information for
tables in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A table is a group of cells ordered into rows and columns. Each table
contains at least one row and one column. Each cell contains a block.
@@ -2729,7 +2730,7 @@ QTextTableFormat::QTextTableFormat(const QTextFormat &fmt)
\brief The QTextImageFormat class provides formatting information for
images in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
Inline images are represented by an object replacement character
(0xFFFC in Unicode) which has an associated QTextImageFormat. The
@@ -2998,7 +2999,7 @@ QTextTableCellFormat::QTextTableCellFormat(const QTextFormat &fmt)
\brief The QTextTableCellFormat class provides formatting information for
table cells in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
The table cell format of a table cell in a document specifies the visual
properties of the table cell.
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 8910394..92b2d4e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1443,14 +1443,13 @@ static bool setFloatAttribute(qreal *destination, const QString &value)
static void setWidthAttribute(QTextLength *width, QString value)
{
- qreal realVal;
bool ok = false;
- realVal = value.toDouble(&ok);
+ qreal realVal = value.toDouble(&ok);
if (ok) {
*width = QTextLength(QTextLength::FixedLength, realVal);
} else {
value = value.trimmed();
- if (!value.isEmpty() && value.at(value.length() - 1) == QLatin1Char('%')) {
+ if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) {
value.chop(1);
realVal = value.toDouble(&ok);
if (ok)
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 3520ab6..fcb22e4 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -128,7 +128,7 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
\brief The QTextInlineObject class represents an inline object in
a QTextLayout.
- \ingroup text
+ \ingroup richtext-processing
This class is only used if the text layout is used to lay out
parts of a QTextDocument.
@@ -285,7 +285,7 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
\brief The QTextLayout class is used to lay out and paint a single
paragraph of text.
- \ingroup text
+ \ingroup richtext-processing
It offers most features expected from a modern text layout
engine, including Unicode compliant rendering, line breaking and
@@ -1368,7 +1368,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
\brief The QTextLine class represents a line of text inside a QTextLayout.
- \ingroup text
+ \ingroup richtext-processing
A text line is usually created by QTextLayout::createLine().
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 8348c92..3e5d7b0 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -63,7 +63,7 @@ public:
\brief The QTextList class provides a decorated list of items in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A list contains a sequence of text blocks, each of which is marked with a
bullet point or other symbol. Multiple levels of lists can be used, and
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 98c92eb..4ac0276 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
\brief The QTextObject class is a base class for different kinds
of objects that can group parts of a QTextDocument together.
- \ingroup text
+ \ingroup richtext-processing
The common grouping text objects are lists (QTextList), frames
(QTextFrame), and tables (QTextTable). A text object has an
@@ -183,7 +183,7 @@ QTextDocumentPrivate *QTextObject::docHandle() const
\brief The QTextBlockGroup class provides a container for text blocks within
a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
Block groups can be used to organize blocks of text within a document.
They maintain an up-to-date list of the text blocks that belong to
@@ -305,7 +305,7 @@ QTextFrameLayoutData::~QTextFrameLayoutData()
\brief The QTextFrame class represents a frame in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
Text frames provide structure for the text in a document. They are used
as generic containers for other document elements.
@@ -412,11 +412,6 @@ QTextFrameLayoutData::~QTextFrameLayoutData()
QTextFrame::QTextFrame(QTextDocument *doc)
: QTextObject(*new QTextFramePrivate(doc), doc)
{
- Q_D(QTextFrame);
- d->fragment_start = 0;
- d->fragment_end = 0;
- d->parentFrame = 0;
- d->layoutData = 0;
}
// ### DOC: What does this do to child frames?
@@ -435,11 +430,6 @@ QTextFrame::~QTextFrame()
QTextFrame::QTextFrame(QTextFramePrivate &p, QTextDocument *doc)
: QTextObject(p, doc)
{
- Q_D(QTextFrame);
- d->fragment_start = 0;
- d->fragment_end = 0;
- d->parentFrame = 0;
- d->layoutData = 0;
}
/*!
@@ -609,7 +599,7 @@ void QTextFramePrivate::remove_me()
\brief The iterator class provides an iterator for reading
the contents of a QTextFrame.
- \ingroup text
+ \ingroup richtext-processing
A frame consists of an arbitrary sequence of \l{QTextBlock}s and
child \l{QTextFrame}s. This class provides a way to iterate over the
@@ -809,7 +799,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator--()
\brief The QTextBlockUserData class is used to associate custom data with blocks of text.
\since 4.1
- \ingroup text
+ \ingroup richtext-processing
QTextBlockUserData provides an abstract interface for container classes that are used
to associate application-specific user data with text blocks in a QTextDocument.
@@ -839,7 +829,7 @@ QTextBlockUserData::~QTextBlockUserData()
\brief The QTextBlock class provides a container for text fragments in a
QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A text block encapsulates a block or paragraph of text in a QTextDocument.
QTextBlock provides read-only access to the block/paragraph structure of
@@ -934,7 +924,7 @@ QTextBlockUserData::~QTextBlockUserData()
\brief The QTextBlock::iterator class provides an iterator for reading
the contents of a QTextBlock.
- \ingroup text
+ \ingroup richtext-processing
A block consists of a sequence of text fragments. This class provides
a way to iterate over these, and read their contents. It does not provide
@@ -1535,7 +1525,7 @@ QTextBlock::iterator &QTextBlock::iterator::operator--()
\brief The QTextFragment class holds a piece of text in a
QTextDocument with a single QTextCharFormat.
- \ingroup text
+ \ingroup richtext-processing
A text fragment describes a piece of text that is stored with a single
character format. Text in which the character format changes can be
diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h
index e862b30..22034c8 100644
--- a/src/gui/text/qtextobject_p.h
+++ b/src/gui/text/qtextobject_p.h
@@ -94,7 +94,7 @@ class QTextFramePrivate : public QTextObjectPrivate
Q_DECLARE_PUBLIC(QTextFrame)
public:
QTextFramePrivate(QTextDocument *doc)
- : QTextObjectPrivate(doc)
+ : QTextObjectPrivate(doc), fragment_start(0), fragment_end(0), parentFrame(0), layoutData(0)
{
}
virtual void fragmentAdded(const QChar &type, uint fragment);
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index cc67113..97b3b35 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -201,7 +201,7 @@ QList<QTextOption::Tab> QTextOption::tabs() const
\brief The QTextOption class provides a description of general rich text
properties.
- \ingroup text
+ \ingroup richtext-processing
QTextOption is used to encapsulate common rich text properties in a single
object. It contains information about text alignment, layout direction,
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 07d09d1..3657698 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
\brief The QTextTableCell class represents the properties of a
cell in a QTextTable.
- \ingroup text
+ \ingroup richtext-processing
Table cells are pieces of document structure that belong to a table.
The table orders cells into particular rows and columns; cells can
@@ -499,7 +499,7 @@ void QTextTablePrivate::update() const
\brief The QTextTable class represents a table in a QTextDocument.
- \ingroup text
+ \ingroup richtext-processing
A table is a group of cells ordered into rows and columns. Each table
contains at least one row and one column. Each cell contains a block, and
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index 4dd52c7..7783b5d 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -62,7 +62,7 @@ class QTextTablePrivate : public QTextFramePrivate
{
Q_DECLARE_PUBLIC(QTextTable)
public:
- QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(0), nRows(0), dirty(true), blockFragmentUpdates(false) {}
+ QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(0), nRows(0), nCols(0), dirty(true), blockFragmentUpdates(false) {}
~QTextTablePrivate();
static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat);
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 13b98bd..70fc05e 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -772,7 +772,7 @@ QList<QZipReader::FileInfo> QZipReader::fileInfoList() const
{
d->scanFiles();
QList<QZipReader::FileInfo> files;
- for (int i = 0; d && i < d->fileHeaders.size(); ++i) {
+ for (int i = 0; i < d->fileHeaders.size(); ++i) {
QZipReader::FileInfo fi;
d->fillFileInfo(i, fi);
files.append(fi);
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index e4d24ff..b28ecd7 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -191,7 +191,7 @@ contains(QT_CONFIG, freetype) {
embedded:CONFIG += opentype
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
- LIBS += -lfreetype
+ LIBS_PRIVATE += -lfreetype
} else {
DEFINES *= QT_NO_FREETYPE
}