Author: mir3x
Date: Wed Oct 28 10:38:00 2015
New Revision: 30274

URL: http://svn.gna.org/viewcvs/freeciv?rev=30274&view=rev
Log:
Chat could stop autoscrolling, if user has marked some text somewhere. 
If also it's scrolled to another page - he won't see marked text 
and chat wont scroll at all, which will be confusing. 
Now chat will be always autoscrolled.

See bug #23968


Modified:
    branches/S2_5/client/gui-qt/chatline.cpp
    branches/S2_5/client/gui-qt/fc_client.cpp

Modified: branches/S2_5/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=30274&r1=30273&r2=30274&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/chatline.cpp    (original)
+++ branches/S2_5/client/gui-qt/chatline.cpp    Wed Oct 28 10:38:00 2015
@@ -16,6 +16,7 @@
 #endif
 
 //Qt
+#include <QScrollBar>
 #include <QStyleFactory>
 
 // client
@@ -168,9 +169,12 @@
 ***************************************************************************/
 void chatwdg::append(QString str)
 {
+  QTextCursor cursor;
+
   chat_output->append(str);
-  chat_output->ensureCursorVisible();
   chat_line->setCompleter(gui()->chat_completer);
+  chat_output->verticalScrollBar()->setSliderPosition(
+                              chat_output->verticalScrollBar()->maximum());
 }
 
 /***************************************************************************

Modified: branches/S2_5/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=30274&r1=30273&r2=30274&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/fc_client.cpp   (original)
+++ branches/S2_5/client/gui-qt/fc_client.cpp   Wed Oct 28 10:38:00 2015
@@ -20,6 +20,7 @@
 #include <QCompleter>
 #include <QMainWindow>
 #include <QLineEdit>
+#include <QScrollBar>
 #include <QStatusBar>
 #include <QTabBar>
 #include <QTextEdit>
@@ -231,9 +232,13 @@
 ****************************************************************************/
 void fc_client::append_output_window(const QString &str)
 {
+  QTextCursor cursor;
+
   if (output_window != NULL) {
     output_window->append(str);
     chat_line->setCompleter(chat_completer);
+    output_window->verticalScrollBar()->setSliderPosition(
+                              output_window->verticalScrollBar()->maximum());
   }
 }
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to