summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2013-01-01 09:37:24 (GMT)
committerRemko Tronçon <git@el-tramo.be>2013-01-01 20:28:17 (GMT)
commite58f7c45a06f72f04f9f30faac909624f3a7c60d (patch)
tree0317f1006e06efb1367865dacacffbf861b66faf
parentfb435e37edac514498fea02fd61baf38d9e2cb12 (diff)
downloadswift-e58f7c45a06f72f04f9f30faac909624f3a7c60d.zip
swift-e58f7c45a06f72f04f9f30faac909624f3a7c60d.tar.bz2
Don't scroll to bottom if there's no scrollbar.
Change-Id: Ieb97996d80108a89aa49f1ec95ccca605ffbf17a
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp
index e674df8..284f3c3 100644
--- a/Swift/QtUI/QtXMLConsoleWidget.cpp
+++ b/Swift/QtUI/QtXMLConsoleWidget.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -96,7 +96,11 @@ void QtXMLConsoleWidget::appendTextIfEnabled(const std::string& data, const QCol
cursor.insertText(P2QSTRING(data));
cursor.endEditBlock();
- if (scrollToBottom) {
+ // Checking for the scrollbar again, because it could have appeared after inserting text.
+ // In practice, I suspect that the scrollbar is always there, but hidden, but since we were
+ // explicitly testing for this already above, I'm leaving the code in.
+ scrollBar = textEdit->verticalScrollBar();
+ if (scrollToBottom && scrollBar) {
scrollBar->setValue(scrollBar->maximum());
}
}