summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-01-04 11:09:38 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-01-04 11:54:23 +0100
commit09b06552f98f8ee8be4d156049a6a37a4abed6bd (patch)
tree92ecbf3d4a4cf87de721aafcc8f40a410ece800d /src
parent254281dae38b932998eb8014a55177948842b78d (diff)
Rename QTextBlockFormat::AtLeastHeight -> MinimumHeight
Make some alterations to merge request 2305: 1. Rename enum for consistency with other APIs in Qt. 2. Correct documentation with actual version number of features. 3. Remove unstandard css syntax in line-height specification. Reviewed-by: Jiang Jiang
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp12
-rw-r--r--src/gui/text/qtextformat.h4
-rw-r--r--src/gui/text/qtexthtmlparser.cpp8
4 files changed, 11 insertions, 15 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 5334ae8ca4..22c6b8c9da 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -2510,7 +2510,7 @@ static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, cons
QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight)
{
*lineHeight = QFixed::fromReal(blockFormat.lineHeight(line.height(), scaling));
- if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::AtLeastHeight) {
+ if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::MinimumHeight) {
*lineBreakHeight = *lineHeight;
if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight)
*lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), 0.0)) - ((*lineHeight * 4) / 5);
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 719db7a74b..b05a830d45 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1878,7 +1878,7 @@ QFont QTextCharFormat::font() const
*/
/*!
- \since 4.7
+ \since 4.8
\enum QTextBlockFormat::LineHeightTypes
This enum describes the various types of line spacing support paragraphs can have.
@@ -1887,7 +1887,7 @@ QFont QTextCharFormat::font() const
\value ProportionalHeight This sets the spacing proportional to the line (in percentage).
For example, set to 200 for double spacing.
\value FixedHeight This sets the line height to a fixed line height (in pixels).
- \value AtLeastHeight This sets the minimum line height (in pixels).
+ \value MinimumHeight This sets the minimum line height (in pixels).
\value LineDistanceHeight This adds the specified height between lines (in pixels).
\sa lineHeight(), lineHeightType(), setLineHeight()
@@ -2112,7 +2112,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
/*!
\fn void QTextBlockFormat::setLineHeight(qreal height, int heightType)
- \since 4.7
+ \since 4.8
This sets the line height for the paragraph to the value in height
which is dependant on heightType, described by the LineHeightTypes enum.
@@ -2123,7 +2123,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
/*!
\fn qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) const
- \since 4.7
+ \since 4.8
This returns what the height of the lines in the paragraph will be depending
on the given height of the script line and the scaling. The value that is returned
@@ -2137,7 +2137,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
/*!
\fn qreal QTextBlockFormat::lineHeight() const
- \since 4.7
+ \since 4.8
This returns the LineHeight property for the paragraph.
@@ -2147,7 +2147,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
/*!
\fn qreal QTextBlockFormat::lineHeightType() const
- \since 4.7
+ \since 4.8
This returns the LineHeightType property of the paragraph.
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index 41cc1d9328..81b053bba3 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -537,7 +537,7 @@ public:
SingleHeight = 0,
ProportionalHeight = 1,
FixedHeight = 2,
- AtLeastHeight = 3,
+ MinimumHeight = 3,
LineDistanceHeight = 4
};
@@ -619,7 +619,7 @@ inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling
return(scriptLineHeight * doubleProperty(LineHeight) / 100.0);
case FixedHeight:
return(doubleProperty(LineHeight) * scaling);
- case AtLeastHeight:
+ case MinimumHeight:
return(qMax(scriptLineHeight, doubleProperty(LineHeight) * scaling));
case LineDistanceHeight:
return(scriptLineHeight + doubleProperty(LineHeight) * scaling);
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 769a50956c..5d5e2b659d 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1252,13 +1252,9 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
break;
case QCss::LineHeight: {
qreal lineHeight;
- if (decl.realValue(&lineHeight, "px"))
+ if (decl.realValue(&lineHeight, "px")) {
blockFormat.setLineHeight(lineHeight, QTextBlockFormat::FixedHeight);
- else if (decl.realValue(&lineHeight, "al"))
- blockFormat.setLineHeight(lineHeight, QTextBlockFormat::AtLeastHeight);
- else if (decl.realValue(&lineHeight, "ld"))
- blockFormat.setLineHeight(lineHeight, QTextBlockFormat::LineDistanceHeight);
- else {
+ } else {
bool ok;
QString value = decl.d->values.first().toString();
lineHeight = value.toDouble(&ok);