From 93e22693b1fc378c87dd6bf749ac530c19dbc3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 16 Apr 2017 18:34:54 +0200 Subject: Fix bug of ScrollBar where the bar was not shown. --- plugingui/textedit.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'plugingui/textedit.cc') diff --git a/plugingui/textedit.cc b/plugingui/textedit.cc index c91b300..1a13530 100644 --- a/plugingui/textedit.cc +++ b/plugingui/textedit.cc @@ -79,17 +79,7 @@ void TextEdit::setText(const std::string& text) _text = text; preprocessText(); - - int ran = height() / font.textHeight(); - - DEBUG(textedit, "Setting range and max of scrollbar to '%d' and '%d'\n", - ran, (int)preprocessedtext.size()); - - scroll.setRange(ran); - scroll.setMaximum(preprocessedtext.size()); - redraw(); - textChangedNotifier(); } @@ -155,9 +145,12 @@ void TextEdit::preprocessText() void TextEdit::repaintEvent(RepaintEvent* repaintEvent) { Painter p(*this); - p.clear(); + // update values of scroll bar + scroll.setRange(height() / font.textHeight()); + scroll.setMaximum(preprocessedtext.size()); + int w = width(); int h = height(); if((w == 0) || (h == 0)) -- cgit v1.2.3