summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-08-20 15:27:36 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-08-20 15:27:36 (GMT)
commit54859f64709f297b97bb48367759479d58f991fe (patch)
tree15ef854ad32180f056f1f16a97bb27a543e3a29e
parenta1d2cc819f381db6b7371c55d3c22ffe56596aed (diff)
downloadswift-contrib-54859f64709f297b97bb48367759479d58f991fe.zip
swift-contrib-54859f64709f297b97bb48367759479d58f991fe.tar.bz2
Don't temporarily show a scrollbar in chat input after growing.
Resolves; #527
-rw-r--r--Swift/QtUI/QtTextEdit.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index 9811bb2..3668220 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -49,8 +49,11 @@ void QtTextEdit::handleTextChanged() {
QSize QtTextEdit::sizeHint() const {
QFontMetrics inputMetrics(currentFont());
- QRect boundingRect = inputMetrics.boundingRect(geometry(), Qt::TextWordWrap, toPlainText());
- int height = boundingRect.height() + inputMetrics.height();
+ QRect horizontalBounds = contentsRect().adjusted(0,0,0,9999);
+ QRect boundingRect = inputMetrics.boundingRect(horizontalBounds, Qt::TextWordWrap, toPlainText() + "A");
+ int left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ int height = boundingRect.height() + top + bottom + inputMetrics.height();
return QSize(width(), height);
//int numberOfLines = 1;
//int lineHeight = inputMetrics.lineSpacing();