From 3478a5c7944a0623ed5bbecedd238c7561ef2b0a Mon Sep 17 00:00:00 2001 From: krepa098 Date: Wed, 14 Jan 2015 20:13:41 +0100 Subject: [PATCH] refactoring --- src/chatlog/chatlog.cpp | 19 ++++--------------- src/chatlog/chatlog.h | 3 +-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index 912b4b662..f1d690b8b 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -188,7 +188,7 @@ qreal ChatLog::layout(int start, int end, qreal width) return deltaY; } -void ChatLog::partialUpdate() +void ChatLog::updateVisibleLines() { checkVisibility(); @@ -226,12 +226,6 @@ void ChatLog::partialUpdate() scrollToBottom(); } -void ChatLog::fullUpdate() -{ - layout(0, lines.size(), useableWidth()); - checkVisibility(); -} - void ChatLog::mousePressEvent(QMouseEvent* ev) { QGraphicsView::mousePressEvent(ev); @@ -657,7 +651,7 @@ void ChatLog::checkVisibility() void ChatLog::scrollContentsBy(int dx, int dy) { QGraphicsView::scrollContentsBy(dx, dy); - partialUpdate(); + updateVisibleLines(); } void ChatLog::resizeEvent(QResizeEvent* ev) @@ -673,16 +667,11 @@ void ChatLog::resizeEvent(QResizeEvent* ev) bool stb = stickToBottom(); QGraphicsView::resizeEvent(ev); - - if(lines.count() > 300) - partialUpdate(); - else - fullUpdate(); + updateVisibleLines(); + updateMultiSelectionRect(); if(stb) scrollToBottom(); - - updateMultiSelectionRect(); } void ChatLog::updateMultiSelectionRect() diff --git a/src/chatlog/chatlog.h b/src/chatlog/chatlog.h index 1c7cba68e..0d6ee5327 100644 --- a/src/chatlog/chatlog.h +++ b/src/chatlog/chatlog.h @@ -65,8 +65,7 @@ protected: void reposition(int start, int end, qreal deltaY); void updateSceneRect(); - void partialUpdate(); - void fullUpdate(); + void updateVisibleLines(); void checkVisibility(); void scrollToBottom();