| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
#ifndef MAINWIDGET_H |
| 5 |
#define MAINWIDGET_H |
| 6 |
|
| 7 |
#include <QtCharts/QChartView> |
| 8 |
#include <QtWidgets/QWidget> |
| 9 |
|
| 10 |
QT_BEGIN_NAMESPACE |
| 11 |
class QGridLayout; |
| 12 |
QT_END_NAMESPACE |
| 13 |
|
| 14 |
QT_BEGIN_NAMESPACE |
| 15 |
class QCandlestickSet; |
| 16 |
class QHCandlestickModelMapper; |
| 17 |
QT_END_NAMESPACE |
| 18 |
|
| 19 |
QT_USE_NAMESPACE |
| 20 |
|
| 21 |
class MainWidget : public QWidget |
| 22 |
{ |
| 23 |
Q_OBJECT |
| 24 |
|
| 25 |
public: |
| 26 |
explicit MainWidget(QWidget *parent = nullptr); |
| 27 |
~MainWidget(); |
| 28 |
|
| 29 |
private: |
| 30 |
QGridLayout *createSeriesControlsLayout(); |
| 31 |
QGridLayout *createSetsControlsLayout(); |
| 32 |
QGridLayout *createCandlestickControlsLayout(); |
| 33 |
QGridLayout *createMiscellaneousControlsLayout(); |
| 34 |
QGridLayout *createModelMapperControlsLayout(); |
| 35 |
|
| 36 |
qreal randomValue(int min, int max) const; |
| 37 |
QCandlestickSet *randomSet(qreal timestamp); |
| 38 |
|
| 39 |
void updateAxes(); |
| 40 |
|
| 41 |
private slots: |
| 42 |
void addSeries(); |
| 43 |
void removeSeries(); |
| 44 |
void removeAllSeries(); |
| 45 |
void addSet(); |
| 46 |
void insertSet(); |
| 47 |
void removeSet(); |
| 48 |
void removeAllSets(); |
| 49 |
void changeMaximumColumnWidth(double width); |
| 50 |
void changeMinimumColumnWidth(double width); |
| 51 |
void bodyOutlineVisibleToggled(bool visible); |
| 52 |
void capsVisibleToggled(bool visible); |
| 53 |
void changeBodyWidth(double width); |
| 54 |
void changeCapsWidth(double width); |
| 55 |
void customIncreasingColorToggled(bool custom); |
| 56 |
void customDecreasingColorToggled(bool custom); |
| 57 |
void antialiasingToggled(bool enabled); |
| 58 |
void animationToggled(bool enabled); |
| 59 |
void legendToggled(bool visible); |
| 60 |
void titleToggled(bool visible); |
| 61 |
void changeChartTheme(int themeIndex); |
| 62 |
void changeAxisX(int axisXIndex); |
| 63 |
void attachModelMapper(); |
| 64 |
void detachModelMapper(); |
| 65 |
|
| 66 |
private: |
| 67 |
QChart *m_chart; |
| 68 |
QChartView *m_chartView; |
| 69 |
QAbstractAxis *m_axisX; |
| 70 |
QAbstractAxis *m_axisY; |
| 71 |
qreal m_maximumColumnWidth; |
| 72 |
qreal m_minimumColumnWidth; |
| 73 |
bool m_bodyOutlineVisible; |
| 74 |
bool m_capsVisible; |
| 75 |
qreal m_bodyWidth; |
| 76 |
qreal m_capsWidth; |
| 77 |
bool m_customIncreasingColor; |
| 78 |
bool m_customDecreasingColor; |
| 79 |
QHCandlestickModelMapper *m_hModelMapper; |
| 80 |
}; |
| 81 |
|
| 82 |
#endif // MAINWIDGET_H |