fixed scrollbars

This commit is contained in:
fourtf
2017-02-01 16:28:28 +01:00
parent dd3843cf6d
commit a09b08f9b0
+4 -1
View File
@@ -7,6 +7,7 @@
#include "widgets/chatwidget.h" #include "widgets/chatwidget.h"
#include <math.h> #include <math.h>
#include <QDebug>
#include <QPainter> #include <QPainter>
#include <functional> #include <functional>
@@ -61,14 +62,16 @@ ChatWidgetView::layoutMessages()
message->layout(this->width(), true); message->layout(this->width(), true);
qDebug() << message->getHeight();
h -= message->getHeight(); h -= message->getHeight();
if (h < 0) { if (h < 0) {
this->scrollbar.setLargeChange((messages.length() - i) + this->scrollbar.setLargeChange((messages.size() - i) +
(qreal)h / message->getHeight()); (qreal)h / message->getHeight());
this->scrollbar.setValue(this->scrollbar.getValue()); this->scrollbar.setValue(this->scrollbar.getValue());
showScrollbar = true; showScrollbar = true;
break;
} }
} }