diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-04-17 14:59:39 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-17 14:59:39 +0200 |
commit | c59680b1d613187209358951589d022d65c6eaa6 (patch) | |
tree | 1e1dad3420f19aa80758b38350d0e8e4a87af174 | |
parent | d091b7db11fc0fa3e19912d03c11d511218608e3 (diff) |
Fix filebrowser scroll bar.
-rw-r--r-- | plugingui/listboxbasic.cc | 10 |
1 files changed, 4 insertions, 6 deletions
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<ListBoxBasic::Item>& 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) |