From 728abec962f993309acf3ebb1317b5f3773f18c7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 8 Feb 2017 22:22:00 +0100 Subject: UI resize refactoring part 1. --- plugingui/widget.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'plugingui/widget.cc') diff --git a/plugingui/widget.cc b/plugingui/widget.cc index 476746e..9b8b173 100644 --- a/plugingui/widget.cc +++ b/plugingui/widget.cc @@ -41,9 +41,6 @@ Widget::Widget(Widget* parent) parent->addChild(this); _window = parent->window(); } - - _width = _height = 0; - _visible = true; } Widget::~Widget() @@ -67,7 +64,11 @@ void Widget::hide() void Widget::setVisible(bool visible) { _visible = visible; - repaintEvent(nullptr); + + if(visible) + { + repaintEvent(nullptr); + } } bool Widget::visible() @@ -112,10 +113,10 @@ void Widget::reparent(Widget* parent) this->parent = parent; } -void Widget::resize(int width, int height) +void Widget::resize(std::size_t width, std::size_t height) { if((width < 1) || (height < 1) || - (((size_t)width == _width) && ((size_t)height == _height))) + ((width == _width) && (height == _height))) { return; } @@ -127,10 +128,11 @@ void Widget::resize(int width, int height) sizeChangeNotifier(width, height); } -void Widget::move(size_t x, size_t y) +void Widget::move(int x, int y) { _x = x; _y = y; + positionChangeNotifier(x, y); } int Widget::x() @@ -143,12 +145,12 @@ int Widget::y() return _y; } -size_t Widget::width() +std::size_t Widget::width() { return _width; } -size_t Widget::height() +std::size_t Widget::height() { return _height; } -- cgit v1.2.3