diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-04-12 13:28:52 (GMT) |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-04-12 14:10:56 (GMT) |
commit | ca8928b78185688ef8e31615ddad4a5c9e2972a7 (patch) | |
tree | efb9d0868b25c4f17969ad801180d5b3ae5e64a4 /src/gui/widgets/qplaintextedit.cpp | |
parent | 9aa4538b219ed759a47e8d1f93c2797bf07b5e2f (diff) | |
download | Qt-ca8928b78185688ef8e31615ddad4a5c9e2972a7.zip Qt-ca8928b78185688ef8e31615ddad4a5c9e2972a7.tar.gz Qt-ca8928b78185688ef8e31615ddad4a5c9e2972a7.tar.bz2 |
Fixed scroll area size calculation on Mac.
This fixes the case where the scroll area was not tall enough, which
happened when the fractional font metrics are returned.
Reviewed-by: mae
Diffstat (limited to 'src/gui/widgets/qplaintextedit.cpp')
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index ef9fac3..2734fba 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -944,8 +944,8 @@ void QPlainTextEditPrivate::_q_adjustScrollbars() int vSliderLength = 0; if (!centerOnScroll && q->isVisible()) { QTextBlock block = doc->lastBlock(); - const int visible = static_cast<int>(viewport->rect().height() - margin - 1); - int y = 0; + const qreal visible = viewport->rect().height() - margin - 1; + qreal y = 0; int visibleFromBottom = 0; while (block.isValid()) { @@ -953,7 +953,7 @@ void QPlainTextEditPrivate::_q_adjustScrollbars() block = block.previous(); continue; } - y += int(documentLayout->blockBoundingRect(block).height()); + y += documentLayout->blockBoundingRect(block).height(); QTextLayout *layout = block.layout(); int layoutLineCount = layout->lineCount(); @@ -962,7 +962,7 @@ void QPlainTextEditPrivate::_q_adjustScrollbars() while (lineNumber < layoutLineCount) { QTextLine line = layout->lineAt(lineNumber); const QRectF lr = line.naturalTextRect(); - if (int(lr.top()) >= y - visible) + if (lr.top() >= y - visible) break; ++lineNumber; } |