summaryrefslogtreecommitdiff
path: root/plugingui/stackedwidget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/stackedwidget.cc')
-rw-r--r--plugingui/stackedwidget.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugingui/stackedwidget.cc b/plugingui/stackedwidget.cc
index 77f0f58..069e80b 100644
--- a/plugingui/stackedwidget.cc
+++ b/plugingui/stackedwidget.cc
@@ -32,6 +32,7 @@ namespace GUI
StackedWidget::StackedWidget(Widget *parent)
: Widget(parent)
{
+ CONNECT(this, sizeChangeNotifier, this, &StackedWidget::sizeChanged);
}
StackedWidget::~StackedWidget()
@@ -41,6 +42,7 @@ StackedWidget::~StackedWidget()
void StackedWidget::addWidget(Widget *widget)
{
widgets.push_back(widget);
+ widget->reparent(this);
if(currentWidget == nullptr)
{
@@ -91,4 +93,14 @@ void StackedWidget::setCurrentWidget(Widget *widget)
currentChanged(currentWidget);
}
+void StackedWidget::sizeChanged(int width, int height)
+{
+ // Propagate size change to child:
+ if(currentWidget)
+ {
+ currentWidget->move(0, 0);
+ currentWidget->resize(width, height);
+ }
+}
+
} // GUI::