1234567891011121314151617181920212223242526272829303132 |
- #ifndef CUSTOMHISTOGRAMBARS_H
- #define CUSTOMHISTOGRAMBARS_H
- #include "qcustomplot.h"
- /**
- * @brief 柱状图上显示值
- */
- class CustomHistogramBars : public QCPBars
- {
- Q_OBJECT
- public:
- explicit CustomHistogramBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
- Qt::Alignment textAligment() const { return m_textAlignment; }
- double spacing() const { return m_spacing; }
- QFont font() const { return m_font; }
- void setTextAlignment(Qt::Alignment alignment);
- void setSpacing(double spacing);
- void setFont(const QFont &font);
- protected:
- Qt::Alignment m_textAlignment; // 文字对齐方式
- double m_spacing; // 文字与柱状图的间距,这里按像素大小
- QFont m_font; // 文字使用的字体
- virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
- };
- #endif // CUSTOMHISTOGRAMBARS_H
|