From 8910e356af01a11cf769b891c1aa51eed2cf960f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 3 Nov 2011 10:45:35 +0100 Subject: Scroll journal to bottom. --- client/pcpviewer/pcpdoc.cc | 22 +++++----------------- client/pcpviewer/pcpdoc.h | 1 + client/pcpviewer/pcpjournal.cc | 1 + 3 files changed, 7 insertions(+), 17 deletions(-) (limited to 'client') diff --git a/client/pcpviewer/pcpdoc.cc b/client/pcpviewer/pcpdoc.cc index 0d2aa41..33fbdd4 100644 --- a/client/pcpviewer/pcpdoc.cc +++ b/client/pcpviewer/pcpdoc.cc @@ -29,6 +29,7 @@ #include #include +#include PCPDoc::PCPDoc(QString codepage) { @@ -54,20 +55,7 @@ void PCPDoc::setText(QString text) setPlainText(jstrip); } -#ifdef TEST_PCPDOC -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). -TEST_TRUE(false, "No tests yet!"); - -TEST_END; - -#endif/*TEST_PCPDOC*/ +void PCPDoc::scrollToBottom() +{ + verticalScrollBar()->setSliderPosition(verticalScrollBar()->maximum()); +} diff --git a/client/pcpviewer/pcpdoc.h b/client/pcpviewer/pcpdoc.h index ad48a26..25cbe68 100644 --- a/client/pcpviewer/pcpdoc.h +++ b/client/pcpviewer/pcpdoc.h @@ -37,6 +37,7 @@ public: PCPDoc(QString codepage); void setText(QString text); + void scrollToBottom(); private: QString codepage; diff --git a/client/pcpviewer/pcpjournal.cc b/client/pcpviewer/pcpjournal.cc index 0ebaf4b..ff5afad 100644 --- a/client/pcpviewer/pcpjournal.cc +++ b/client/pcpviewer/pcpjournal.cc @@ -39,4 +39,5 @@ PCPJournal::PCPJournal() void PCPJournal::setData(QString data) { doc->setText(data); + doc->scrollToBottom(); } -- cgit v1.2.3