mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
statistics: don't crash if the QCharts QML modules aren't found
We don't really give a user visible error message which is kind of a problem, but at least we don't crash anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6a6dd0888a
commit
1f1d82b1b3
1 changed files with 9 additions and 5 deletions
|
@ -65,14 +65,18 @@ StatsView::StatsView(QWidget *parent) : QQuickWidget(parent),
|
||||||
eventFilter(this)
|
eventFilter(this)
|
||||||
{
|
{
|
||||||
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
|
// if we get a failure to load the QML file (e.g., when the QtCharts QML modules aren't found)
|
||||||
|
// the chart will be null
|
||||||
setSource(urlStatsView);
|
setSource(urlStatsView);
|
||||||
chart = getChart(rootObject());
|
chart = getChart(rootObject());
|
||||||
connect(chart, &QtCharts::QChart::plotAreaChanged, this, &StatsView::plotAreaChanged);
|
if (chart) {
|
||||||
connect(&diveListNotifier, &DiveListNotifier::numShownChanged, this, &StatsView::replotIfVisible);
|
connect(chart, &QtCharts::QChart::plotAreaChanged, this, &StatsView::plotAreaChanged);
|
||||||
|
connect(&diveListNotifier, &DiveListNotifier::numShownChanged, this, &StatsView::replotIfVisible);
|
||||||
|
|
||||||
chart->installEventFilter(&eventFilter);
|
chart->installEventFilter(&eventFilter);
|
||||||
chart->setAcceptHoverEvents(true);
|
chart->setAcceptHoverEvents(true);
|
||||||
chart->legend()->setVisible(false);
|
chart->legend()->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatsView::~StatsView()
|
StatsView::~StatsView()
|
||||||
|
|
Loading…
Reference in a new issue