stats: fix visibility check of the statistics tab on desktop
Apparently, the visibility flag of the view is not inherited from the statistics widget. Therefore, the statistics is redrawn on every action even if not visible. Set the visibility explicitly in the show- and hide-events. This is crazy. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
01fb69e198
commit
f299fa37f9
@ -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()
|
||||
|
||||
@ -37,6 +37,7 @@ private:
|
||||
|
||||
ChartListModel charts;
|
||||
void showEvent(QShowEvent *) override;
|
||||
void hideEvent(QHideEvent *) override;
|
||||
};
|
||||
|
||||
#endif // STATSWIDGET_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user