mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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
2 changed files with 14 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue