summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocumentlayout.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2011-02-10 22:35:31 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2011-02-10 22:35:31 (GMT)
commitca13ba801144763b1ca7c39b2ef8594de94e2d3e (patch)
tree7600e31df6ce715a5bc28c0c97983bac9484c7cb /src/gui/text/qtextdocumentlayout.cpp
parentab38731fe5dcfaa1a7a70bc290a8856b5b01524d (diff)
parentec20a6da3edea3031f1705c3b13e24dc2c7c6de5 (diff)
downloadQt-ca13ba801144763b1ca7c39b2ef8594de94e2d3e.zip
Qt-ca13ba801144763b1ca7c39b2ef8594de94e2d3e.tar.gz
Qt-ca13ba801144763b1ca7c39b2ef8594de94e2d3e.tar.bz2
Merge remote-tracking branch 'origin/4.7' into HEAD
Diffstat (limited to 'src/gui/text/qtextdocumentlayout.cpp')
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index d721c91..a1dcb63 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -513,6 +513,9 @@ public:
qreal scaleToDevice(qreal value) const;
QFixed scaleToDevice(QFixed value) const;
+
+ qreal lineH;
+ QTextDocumentLayout::LineHeightMode lineHeightMode;
};
QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate()
@@ -520,7 +523,9 @@ QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate()
cursorWidth(1),
currentLazyLayoutPosition(-1),
lazyLayoutStepSize(1000),
- lastPageCount(-1)
+ lastPageCount(-1),
+ lineH(1),
+ lineHeightMode(QTextDocumentLayout::ProportionalHeight)
{
showLayoutProgress = true;
insideDocumentChange = false;
@@ -2639,7 +2644,10 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
}
- QFixed lineHeight = QFixed::fromReal(line.height());
+ // TODO: replace with proper line height support in 4.8
+ QFixed lineHeight = (lineHeightMode == QTextDocumentLayout::FixedHeight)
+ ? QFixed::fromReal(lineH) : QFixed::fromReal(line.height() * lineH);
+
if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineHeight > layoutStruct->pageBottom) {
layoutStruct->newPage();
@@ -2714,6 +2722,13 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
}
}
+void QTextDocumentLayout::setLineHeight(qreal lineH, QTextDocumentLayout::LineHeightMode mode = QTextDocumentLayout::ProportionalHeight)
+{
+ Q_D(QTextDocumentLayout);
+ d->lineH = lineH;
+ d->lineHeightMode = mode;
+}
+
void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct,
QFixed *left, QFixed *right) const
{