Skip to content
Permalink
Browse files

Fix issue where the chat box does not scroll down when an image is lo…

…aded (#1258)
  • Loading branch information...
bontibon authored and mkrautz committed May 30, 2014
1 parent 4f7ede5 commit 2b8fc35f3ff613bdcd4c1fa584c76907eee279f2
Showing with 23 additions and 0 deletions.
  1. +8 −0 src/mumble/CustomElements.cpp
  2. +1 −0 src/mumble/CustomElements.h
  3. +7 −0 src/mumble/Log.cpp
  4. +7 −0 src/mumble/Log.h
@@ -36,6 +36,7 @@
#include "ClientUser.h"
#include "Global.h"
#include "MainWindow.h"
#include "Log.h"


LogTextBrowser::LogTextBrowser(QWidget *p) : QTextBrowser(p) {}
@@ -45,6 +46,13 @@ void LogTextBrowser::resizeEvent(QResizeEvent *e) {
QTextBrowser::resizeEvent(e);
}

bool LogTextBrowser::event(QEvent *e) {
if (e->type() == LogDocumentResourceAddedEvent::Type) {
scrollLogToBottom();
}
return QTextBrowser::event(e);
}

int LogTextBrowser::getLogScroll() {
return verticalScrollBar()->value();
}
@@ -50,6 +50,7 @@ class LogTextBrowser : public QTextBrowser {
Q_DISABLE_COPY(LogTextBrowser)
protected:
virtual void resizeEvent(QResizeEvent *e);
virtual bool event(QEvent *e);
public:
LogTextBrowser(QWidget *p = NULL);

@@ -679,6 +679,9 @@ void LogDocument::finished() {
if (qte != NULL) {
QEvent *e = new QEvent(QEvent::FontChange);
QApplication::postEvent(qte, e);

e = new LogDocumentResourceAddedEvent();
QApplication::postEvent(qte, e);
}
} else {
m_valid = false;
@@ -691,3 +694,7 @@ void LogDocument::finished() {

rep->deleteLater();
}

LogDocumentResourceAddedEvent::LogDocumentResourceAddedEvent()
: QEvent(LogDocumentResourceAddedEvent::Type) {
}
@@ -119,4 +119,11 @@ class LogDocument : public QTextDocument {
bool m_onlyLoadDataURLs;
};

class LogDocumentResourceAddedEvent : public QEvent {
public:
static const QEvent::Type Type = static_cast<QEvent::Type>(20145);

LogDocumentResourceAddedEvent();
};

#endif

0 comments on commit 2b8fc35

Please sign in to comment.
You can’t perform that action at this time.