From c59680b1d613187209358951589d022d65c6eaa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Mon, 17 Apr 2017 14:59:39 +0200 Subject: Fix filebrowser scroll bar. --- plugingui/listboxbasic.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'plugingui') diff --git a/plugingui/listboxbasic.cc b/plugingui/listboxbasic.cc index 642d03f..668d4d0 100644 --- a/plugingui/listboxbasic.cc +++ b/plugingui/listboxbasic.cc @@ -36,7 +36,7 @@ ListBoxBasic::ListBoxBasic(Widget *parent) , scroll(this) { scroll.move(0,0); - scroll.resize(18, 100); + scroll.resize(16, 100); CONNECT(&scroll, valueChangeNotifier, this, &ListBoxBasic::onScrollBarValueChange); @@ -84,10 +84,6 @@ void ListBoxBasic::addItems(const std::vector& newItems) //setSelection((int)items.size() - 1); setSelection(0); } - - int numitems = height() / (font.textHeight() + padding); - scroll.setRange(numitems); - scroll.setMaximum(items.size()); redraw(); } @@ -146,7 +142,6 @@ void ListBoxBasic::onScrollBarValueChange(int value) void ListBoxBasic::repaintEvent(RepaintEvent* repaintEvent) { Painter p(*this); - p.clear(); int w = width(); @@ -190,6 +185,9 @@ void ListBoxBasic::repaintEvent(RepaintEvent* repaintEvent) p.drawText(2, yoffset + font.textHeight(), font, item.name); yoffset += font.textHeight() + padding; } + + scroll.setRange(numitems); + scroll.setMaximum(items.size()); } void ListBoxBasic::scrollEvent(ScrollEvent* scrollEvent) -- cgit v1.2.3