aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/statswidget.cpp13
-rw-r--r--desktop-widgets/statswidget.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/desktop-widgets/statswidget.cpp b/desktop-widgets/statswidget.cpp
index 465d5d496..6b936915f 100644
--- a/desktop-widgets/statswidget.cpp
+++ b/desktop-widgets/statswidget.cpp
@@ -93,6 +93,8 @@ StatsWidget::StatsWidget(QWidget *parent) : QWidget(parent)
view = qobject_cast<StatsView *>(root);
if (!view)
qWarning("Oops. The root of the StatsView is not a StatsView.");
+ if (view)
+ view->setVisible(isVisible()); // Synchronize visibility of widget and QtQuick-view.
}
// Initialize QComboBox with list of variables
@@ -209,6 +211,17 @@ void StatsWidget::showEvent(QShowEvent *e)
unrestrict();
updateUi();
QWidget::showEvent(e);
+ // Apparently, we have to manage the visibility of the view ourselves. That's mad.
+ if (view)
+ view->setVisible(true);
+}
+
+void StatsWidget::hideEvent(QHideEvent *e)
+{
+ QWidget::hideEvent(e);
+ // Apparently, we have to manage the visibility of the view ourselves. That's mad.
+ if (view)
+ view->setVisible(false);
}
void StatsWidget::restrict()
diff --git a/desktop-widgets/statswidget.h b/desktop-widgets/statswidget.h
index 4ae86a015..c3397d613 100644
--- a/desktop-widgets/statswidget.h
+++ b/desktop-widgets/statswidget.h
@@ -37,6 +37,7 @@ private:
ChartListModel charts;
void showEvent(QShowEvent *) override;
+ void hideEvent(QHideEvent *) override;
};
#endif // STATSWIDGET_H