aboutsummaryrefslogtreecommitdiff
path: root/courtroom.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2018-07-27 22:07:48 -0400
committerGitHub <noreply@github.com>2018-07-27 22:07:48 -0400
commit68a3f35fb0a39a57d50c3d3098710c667a166477 (patch)
treeb195cf59bd09ae4af0d9825fb8adc19f5eb219f7 /courtroom.cpp
parent3129d2aded8a323dce9a184e3da99daac8bea35a (diff)
parentcab730422f59c9ea75a5e175a3cffdbca097880c (diff)
Merge pull request #24 from ghostfeesh/version-bump
Bump to 2.4.10, autoscrolling bug fixes
Diffstat (limited to 'courtroom.cpp')
-rw-r--r--courtroom.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/courtroom.cpp b/courtroom.cpp
index 76d6b03f..bc0b0ad0 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -1146,21 +1146,18 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
- QTextCursor::MoveOperation move_op;
int scrollbar_limit;
if(ao_app->ic_scroll_down_enabled()) {
scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->maximum();
- move_op = QTextCursor::End;
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
}
else {
scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->minimum();
- move_op = QTextCursor::Start;
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
}
const bool is_fully_scrolled = old_scrollbar_value == scrollbar_limit;
-
- ui_ic_chatlog->moveCursor(move_op);
ui_ic_chatlog->textCursor().insertText(p_name, bold);
ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
@@ -1174,8 +1171,14 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
else
{
// The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
- ui_ic_chatlog->moveCursor(move_op);
- ui_ic_chatlog->verticalScrollBar()->setValue(scrollbar_limit);
+ if(ao_app->ic_scroll_down_enabled()) {
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum());
+ }
+ else {
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum());
+ }
}
}