SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
ProgressWindow.h
Go to the documentation of this file.
1// SedSAT3 – Sediment Source Assessment Tool, version 3
2// U.S. Geological Survey. See LICENSE.md and DISCLAIMER.md in the repository root.
3
4#pragma once
5
6#include <QWidget>
7#include <QDialog>
8#include "ui_ProgressWindow.h"
9#include <qchartview.h>
10#include <qchart.h>
11#include <QtCharts/QLineSeries>
12#include <QtCharts/QValueAxis>
13#include "QtCharts/QAreaSeries"
14#include "progressreporter.h"
15
16#ifndef Qt6
17using namespace QtCharts;
18#endif
19
21
23{
24 QChart* chart;
25 QChartView *chartView;
26 QLineSeries* series;
27 QAreaSeries* areaseries;
28 QValueAxis *yaxis;
29 QValueAxis *xaxis;
30};
31
39class ProgressWindow : public QDialog, public ProgressReporter
40{
41 Q_OBJECT
42
43public:
44 ProgressWindow(QWidget *parent = Q_NULLPTR, int number_of_panels=1, bool extra_label_and_progressbar = false);
46 void AppendPoint(const double& x, const double& y, int chart=0) override;
47 void SetProgress(const double& prog) override;
48 void SetProgress2(const double& prog) override;
49 void SetLabel(const QString& label) override;
50 void SetYRange(const double &y0, const double &y1, int chart=0) override;
51 void SetXRange(const double &x0, const double &x1, int chart=0) override;
52 void SetTitle(const QString &title, int chart=0) override;
53 void SetXAxisTitle(const QString &title, int chart=0) override;
54 void SetYAxisTitle(const QString &title, int chart=0) override;
55 void ClearGraph(int chart=0) override;
56 void SetChartTitle(int i, const QString &title) override
57 {
58 if (ChartItems.size()>i)
59 { charttitles[i]=title;
60 ChartItems[i].chart->setTitle(title);
61 }
62 }
63
65 void Start() override { show(); }
66
68 void Finish() override { close(); }
69private:
71 bool HasChart(int chart) const;
72 Ui::ProgressWindow ui{};
73 QVector<ChartCollection> ChartItems;
74 QVector<QString> charttitles;
75};
progress_window_mode
Abstract sink for progress information produced by a running analysis.
void SetProgress2(const double &prog) override
Sets the secondary progress fraction, where one is displayed.
void SetTitle(const QString &title, int chart=0) override
Sets the title of a chart.
void SetYRange(const double &y0, const double &y1, int chart=0) override
Sets the vertical range of a chart.
void SetXAxisTitle(const QString &title, int chart=0) override
Sets the horizontal axis title of a chart.
void SetChartTitle(int i, const QString &title) override
Sets the title of chart i.
ProgressWindow(QWidget *parent=Q_NULLPTR, int number_of_panels=1, bool extra_label_and_progressbar=false)
void SetXRange(const double &x0, const double &x1, int chart=0) override
Sets the horizontal range of a chart.
Ui::ProgressWindow ui
bool HasChart(int chart) const
True if chart is one of this window's chart panels.
void ClearGraph(int chart=0) override
Discards the points accumulated in a chart.
QVector< ChartCollection > ChartItems
void SetYAxisTitle(const QString &title, int chart=0) override
Sets the vertical axis title of a chart.
void Finish() override
Closes the dialog. Named Finish() because QWidget::close() is not virtual.
void SetProgress(const double &prog) override
Sets the primary progress fraction.
void SetLabel(const QString &label) override
Sets the free-text status label.
void Start() override
Shows the dialog. Named Start() because QWidget::show() is not virtual.
QVector< QString > charttitles
void AppendPoint(const double &x, const double &y, int chart=0) override
Adds a point to one of the progress charts.
QValueAxis * xaxis
QAreaSeries * areaseries
QValueAxis * yaxis
QLineSeries * series
QChartView * chartView