diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-05-19 19:09:17 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-05-19 19:09:17 +0200 |
commit | ff83cfac10939ceba524c93d4e36f634f4bec805 (patch) | |
tree | d481913f2136bf04d2d1deb650e6bd084a531676 /plugingui/tabwidget.cc | |
parent | a3dc9bd19f976cbc84ba3d1a16c72257b42b28ba (diff) |
Make sure we don't resize to negative values.
Diffstat (limited to 'plugingui/tabwidget.cc')
-rw-r--r-- | plugingui/tabwidget.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugingui/tabwidget.cc b/plugingui/tabwidget.cc index dde2137..b18f62f 100644 --- a/plugingui/tabwidget.cc +++ b/plugingui/tabwidget.cc @@ -94,13 +94,13 @@ void TabWidget::sizeChanged(int width, int height) { std::size_t pos = 0; - std::size_t button_width = 1; - std::size_t bar_height = 25; - std::size_t button_border_width = 10; + int button_width = 1; + int bar_height = 25; + int button_border_width = 10; - std::size_t button_padding_left = 25; - std::size_t button_padding_inner = 3; - std::size_t logo_padding_right = button_padding_left / 2; + int button_padding_left = 25; + int button_padding_inner = 3; + int logo_padding_right = button_padding_left / 2; Painter p(*this); @@ -108,11 +108,11 @@ void TabWidget::sizeChanged(int width, int height) { for (auto& button : buttons) { - auto min_width = button.getMinimalWidth(); + int min_width = button.getMinimalWidth(); button_width = std::max(button_width, min_width + button_border_width); } - button_width = std::min(button_width, width / buttons.size()); + button_width = std::min(button_width, width / (int)buttons.size()); } // draw the upper bar @@ -132,7 +132,7 @@ void TabWidget::sizeChanged(int width, int height) } stack.move(0, bar_height); - stack.resize(width, height - bar_height); + stack.resize(width, std::max((int)height - bar_height, 0)); } } // GUI:: |