qabstractaxis.h
210 lines
| 7.9 KiB
| text/x-c
|
CLexer
|
r2845 | /****************************************************************************** | ||
|
r1540 | ** | ||
|
r2845 | ** Copyright (C) 2015 The Qt Company Ltd. | ||
** Contact: http://www.qt.io/licensing/ | ||||
|
r1540 | ** | ||
|
r2740 | ** This file is part of the Qt Charts module. | ||
|
r1540 | ** | ||
|
r2845 | ** $QT_BEGIN_LICENSE:COMM$ | ||
|
r1540 | ** | ||
|
r2845 | ** Commercial License Usage | ||
** Licensees holding valid commercial Qt licenses may use this file in | ||||
** accordance with the commercial license agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and The Qt Company. For licensing terms | ||||
** and conditions see http://www.qt.io/terms-conditions. For further | ||||
** information use the contact form at http://www.qt.io/contact-us. | ||||
|
r1540 | ** | ||
|
r2845 | ** $QT_END_LICENSE$ | ||
** | ||||
******************************************************************************/ | ||||
|
r1540 | |||
#ifndef QABSTRACTAXIS_H | ||||
#define QABSTRACTAXIS_H | ||||
|
r2714 | #include <QtCharts/QChartGlobal> | ||
#include <QtGui/QPen> | ||||
#include <QtGui/QFont> | ||||
#include <QtCore/QVariant> | ||||
|
r1540 | |||
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
|
r1540 | |||
class QAbstractAxisPrivate; | ||||
|
r2712 | class QT_CHARTS_EXPORT QAbstractAxis : public QObject | ||
|
r1540 | { | ||
|
r2093 | Q_OBJECT | ||
|
r2273 | //visibility | ||
|
r2093 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) | ||
|
r2273 | //arrow | ||
|
r1845 | Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged) | ||
|
r2273 | Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged) | ||
|
r1844 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) | ||
|
r2273 | //labels | ||
|
r1540 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) | ||
|
r2361 | Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) | ||
|
r2273 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) | ||
Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) | ||||
|
r1540 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) | ||
|
r2273 | //grid | ||
|
r2282 | Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged) | ||
|
r2361 | Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged) | ||
|
r2795 | Q_PROPERTY(bool minorGridVisible READ isMinorGridLineVisible WRITE setMinorGridLineVisible NOTIFY minorGridVisibleChanged) | ||
Q_PROPERTY(QPen minorGridLinePen READ minorGridLinePen WRITE setMinorGridLinePen NOTIFY minorGridLinePenChanged) | ||||
|
r2810 | Q_PROPERTY(QColor gridLineColor READ gridLineColor WRITE setGridLineColor NOTIFY gridLineColorChanged) | ||
Q_PROPERTY(QColor minorGridLineColor READ minorGridLineColor WRITE setMinorGridLineColor NOTIFY minorGridLineColorChanged) | ||||
|
r2273 | //shades | ||
|
r1540 | Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged) | ||
Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged) | ||||
Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged) | ||||
|
r2273 | Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged) | ||
Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged) | ||||
//title | ||||
Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged) | ||||
Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged) | ||||
|
r2297 | Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged) | ||
Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged) | ||||
|
r2276 | //orientation | ||
|
r2348 | Q_PROPERTY(Qt::Orientation orientation READ orientation) | ||
|
r2276 | //aligment | ||
Q_PROPERTY(Qt::Alignment alignment READ alignment) | ||||
|
r2781 | Q_PROPERTY(bool reverse READ isReverse WRITE setReverse NOTIFY reverseChanged) | ||
|
r1540 | |||
public: | ||||
enum AxisType { | ||||
|
r1588 | AxisTypeNoAxis = 0x0, | ||
|
r1818 | AxisTypeValue = 0x1, | ||
AxisTypeBarCategory = 0x2, | ||||
|
r2719 | AxisTypeCategory = 0x4, | ||
AxisTypeDateTime = 0x8, | ||||
AxisTypeLogValue = 0x10 | ||||
|
r1540 | }; | ||
|
r1588 | Q_DECLARE_FLAGS(AxisTypes, AxisType) | ||
|
r1540 | protected: | ||
|
r2871 | explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = Q_NULLPTR); | ||
|
r1540 | |||
public: | ||||
~QAbstractAxis(); | ||||
virtual AxisType type() const = 0; | ||||
|
r2273 | //visibility handling | ||
|
r1617 | bool isVisible() const; | ||
void setVisible(bool visible = true); | ||||
|
r2273 | void show(); | ||
void hide(); | ||||
|
r1617 | |||
|
r2273 | //arrow handling | ||
|
r1844 | bool isLineVisible() const; | ||
void setLineVisible(bool visible = true); | ||||
void setLinePen(const QPen &pen); | ||||
QPen linePen() const; | ||||
void setLinePenColor(QColor color); | ||||
QColor linePenColor() const; | ||||
|
r1540 | |||
//grid handling | ||||
bool isGridLineVisible() const; | ||||
void setGridLineVisible(bool visible = true); | ||||
void setGridLinePen(const QPen &pen); | ||||
QPen gridLinePen() const; | ||||
|
r2795 | bool isMinorGridLineVisible() const; | ||
void setMinorGridLineVisible(bool visible = true); | ||||
void setMinorGridLinePen(const QPen &pen); | ||||
QPen minorGridLinePen() const; | ||||
|
r2810 | void setGridLineColor(const QColor &color); | ||
QColor gridLineColor(); | ||||
void setMinorGridLineColor(const QColor &color); | ||||
QColor minorGridLineColor(); | ||||
|
r1540 | |||
//labels handling | ||||
bool labelsVisible() const; | ||||
void setLabelsVisible(bool visible = true); | ||||
void setLabelsBrush(const QBrush &brush); | ||||
QBrush labelsBrush() const; | ||||
void setLabelsFont(const QFont &font); | ||||
QFont labelsFont() const; | ||||
void setLabelsAngle(int angle); | ||||
int labelsAngle() const; | ||||
void setLabelsColor(QColor color); | ||||
QColor labelsColor() const; | ||||
|
r1965 | //title handling | ||
|
r2297 | bool isTitleVisible() const; | ||
|
r1965 | void setTitleVisible(bool visible = true); | ||
void setTitleBrush(const QBrush &brush); | ||||
QBrush titleBrush() const; | ||||
void setTitleFont(const QFont &font); | ||||
QFont titleFont() const; | ||||
|
r2273 | void setTitleText(const QString &title); | ||
QString titleText() const; | ||||
|
r1965 | |||
|
r1540 | //shades handling | ||
bool shadesVisible() const; | ||||
void setShadesVisible(bool visible = true); | ||||
void setShadesPen(const QPen &pen); | ||||
QPen shadesPen() const; | ||||
void setShadesBrush(const QBrush &brush); | ||||
QBrush shadesBrush() const; | ||||
void setShadesColor(QColor color); | ||||
QColor shadesColor() const; | ||||
void setShadesBorderColor(QColor color); | ||||
QColor shadesBorderColor() const; | ||||
|
r2742 | Qt::Orientation orientation() const; | ||
|
r2105 | Qt::Alignment alignment() const; | ||
|
r1695 | |||
|
r1541 | //range handling | ||
|
r1578 | void setMin(const QVariant &min); | ||
void setMax(const QVariant &max); | ||||
void setRange(const QVariant &min, const QVariant &max); | ||||
|
r1540 | |||
|
r2781 | //reverse handling | ||
void setReverse(bool reverse = true); | ||||
bool isReverse() const; | ||||
|
r1540 | Q_SIGNALS: | ||
void visibleChanged(bool visible); | ||||
|
r2483 | void linePenChanged(const QPen &pen); | ||
|
r1844 | void lineVisibleChanged(bool visible); | ||
|
r1540 | void labelsVisibleChanged(bool visible); | ||
|
r2483 | void labelsBrushChanged(const QBrush &brush); | ||
void labelsFontChanged(const QFont &pen); | ||||
|
r2273 | void labelsAngleChanged(int angle); | ||
|
r2483 | void gridLinePenChanged(const QPen &pen); | ||
|
r2282 | void gridVisibleChanged(bool visible); | ||
|
r2795 | void minorGridVisibleChanged(bool visible); | ||
void minorGridLinePenChanged(const QPen &pen); | ||||
|
r2810 | void gridLineColorChanged(const QColor &color); | ||
void minorGridLineColorChanged(const QColor &color); | ||||
|
r1540 | void colorChanged(QColor color); | ||
void labelsColorChanged(QColor color); | ||||
|
r2483 | void titleTextChanged(const QString &title); | ||
void titleBrushChanged(const QBrush &brush); | ||||
|
r2273 | void titleVisibleChanged(bool visible); | ||
|
r2483 | void titleFontChanged(const QFont &font); | ||
|
r1540 | void shadesVisibleChanged(bool visible); | ||
void shadesColorChanged(QColor color); | ||||
void shadesBorderColorChanged(QColor color); | ||||
|
r2483 | void shadesPenChanged(const QPen &pen); | ||
void shadesBrushChanged(const QBrush &brush); | ||||
|
r2781 | void reverseChanged(bool reverse); | ||
|
r1540 | |||
protected: | ||||
|
r2093 | QScopedPointer<QAbstractAxisPrivate> d_ptr; | ||
|
r1541 | friend class ChartDataSet; | ||
|
r1556 | friend class ChartPresenter; | ||
|
r2273 | friend class ChartThemeManager; | ||
|
r2284 | friend class AbstractDomain; | ||
|
r2483 | friend class ChartAxisElement; | ||
friend class XYChart; | ||||
|
r2723 | |||
private: | ||||
Q_DISABLE_COPY(QAbstractAxis) | ||||
|
r1540 | }; | ||
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
|
r2046 | |||
#endif // QABSTRACTAXIS_H | ||||