-
Notifications
You must be signed in to change notification settings - Fork 51
/
GridItem.h
72 lines (51 loc) · 1.79 KB
/
GridItem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*****************************************************************************
* Qwt Examples - Copyright (C) 2002 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#pragma once
#include <QwtPlotItem>
#include <QwtScaleDiv>
#include <QPalette>
class GridItem : public QwtPlotItem
{
public:
enum GridAttribute
{
AutoUpdate = 0x01,
FillCanvas = 0x02
};
typedef QFlags< GridAttribute > GridAttributes;
explicit GridItem();
virtual ~GridItem();
virtual int rtti() const QWT_OVERRIDE;
void setGridAttribute( GridAttribute, bool on = true );
bool testGridAttribute( GridAttribute ) const;
void setOrientations( Qt::Orientations );
Qt::Orientations orientations() const;
void enableXMin( bool );
bool isXMinEnabled() const;
void enableYMin( bool );
bool isYMinEnabled() const;
void setXDiv( const QwtScaleDiv& sx );
const QwtScaleDiv& xScaleDiv() const;
void setYDiv( const QwtScaleDiv& sy );
const QwtScaleDiv& yScaleDiv() const;
void setPalette( const QPalette& );
QPalette palette() const;
virtual void draw( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& rect ) const QWT_OVERRIDE;
virtual void updateScaleDiv(
const QwtScaleDiv& xMap, const QwtScaleDiv& yMap ) QWT_OVERRIDE;
protected:
virtual QBrush brush( int row, int column, const QRectF& ) const;
private:
Qt::Orientations m_orientations;
GridAttributes m_gridAttributes;
QwtScaleDiv m_xScaleDiv;
QwtScaleDiv m_yScaleDiv;
bool m_isXMinEnabled;
bool m_isYMinEnabled;
QPalette m_palette;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( GridItem::GridAttributes )