Qt Virtual Chart Table (QVCT)
COverlay.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 #ifndef QVCT_COVERLAY_HPP
20 #define QVCT_COVERLAY_HPP
21 
22 // QT
23 #include <QPainter>
24 #include <QTreeWidgetItem>
25 #include <QWidget>
26 
27 // QVCT
28 class CChart;
29 class COverlayPoint;
30 
31 
33 
44 class COverlay: public QTreeWidgetItem
45 {
46 
47  //------------------------------------------------------------------------------
48  // FIELDS
49  //------------------------------------------------------------------------------
50 protected:
52  QString qsName;
53 
55 
56  bool bVisible;
57 
59  QPixmap qPixmapBuffer;
65  double fdZoomPixmap;
68 
70  QFont qFont;
72 
73  QBrush qBrushText;
75 
76  QPen qPenText;
78 
79  QBrush qBrushMarker;
81 
82  QPen qPenMarker;
84 
87 
90 
91  QPen qPenLine;
93 
94  QPen qPenVector;
95 
96 
97  //------------------------------------------------------------------------------
98  // CONSTRUCTORS / DESTRUCTOR
99  //------------------------------------------------------------------------------
100 
101 protected:
102  COverlay( const QString& _rqsName );
103  virtual ~COverlay() {};
104 
105 
106  //------------------------------------------------------------------------------
107  // METHODS
108  //------------------------------------------------------------------------------
109 
110  // SETTERS
111 public:
113  void setVisible( bool _bVisible ) { bVisible = _bVisible; };
115  void forceRedraw() { bForceRedraw = true; };
116 
117  // GETTERS
118 public:
120  bool isVisible() const { return bVisible; };
121  bool isRedrawForced() const { return bForceRedraw; };
122  const QFont& getFont() const { return qFont; };
123  const QBrush& getBrushText() const { return qBrushText; };
124  const QPen& getPenText() const { return qPenText; };
125  const QBrush& getBrushMarker() const { return qBrushMarker; };
126  const QPen& getPenMarker() const { return qPenMarker; };
127  const QBrush& getBrushMarkerSelected() const { return qBrushMarkerSelected; };
128  const QPen& getPenMarkerSelected() const { return qPenMarkerSelected; };
129  const QPen& getPenLine() const { return qPenLine; };
130  const QPen& getPenVector() const { return qPenVector; };
131 
132  // OTHER
133 public:
135  void draw( const CChart* _poChart, QPainter* _pqPainter );
137  virtual void drawContent( const CChart* _poChart, QPainter* _pqPainter ) const = 0;
139  virtual void showDetail( const QTreeWidgetItem* _pqTreeWidgetItem ) const = 0;
141  virtual void setPosition( const QTreeWidgetItem* _pqTreeWidgetItem ) const = 0;
143  virtual COverlayPoint* matchScrPosition( const CChart* _poChart, const QPointF& _rqPointFScrPosition ) const = 0;
144 
145 public:
147 
151  QString newChildName( const QString& _rqsName, int __iZeroPrefix = 0, bool __bForceSuffix = false ) const;
152 
153 };
154 
155 #endif // QVCT_COVERLAY_HPP
[UI] Chart (view)
Definition: CChart.hpp:44
Generic overlay point.
Generic overlay.
Definition: COverlay.hpp:45
const QBrush & getBrushText() const
Definition: COverlay.hpp:123
void setVisible(bool _bVisible)
Sets this overlay items' global visibility status.
Definition: COverlay.hpp:113
const CChart * poChartPixmap
Chart for which the last rendering was achieved.
Definition: COverlay.hpp:61
QPixmap qPixmapBuffer
Pixmap buffer used to render and cache this overlay's graphical content.
Definition: COverlay.hpp:59
const QBrush & getBrushMarker() const
Definition: COverlay.hpp:125
bool bForceRedraw
Forces this overlay's rendering (not matter its cache content)
Definition: COverlay.hpp:67
virtual ~COverlay()
Definition: COverlay.hpp:103
virtual void drawContent(const CChart *_poChart, QPainter *_pqPainter) const =0
Draws this overlay's content.
bool isRedrawForced() const
Definition: COverlay.hpp:121
QString newChildName(const QString &_rqsName, int __iZeroPrefix=0, bool __bForceSuffix=false) const
Returns a valid name for a new sibling of this object.
Definition: COverlay.cpp:123
QPen qPenLine
QPen used to draw lines on this overlay.
Definition: COverlay.hpp:91
QPen qPenVector
QPen used to draw vectors on this overlay.
Definition: COverlay.hpp:94
QPen qPenText
QPen used to draw text on this overlay.
Definition: COverlay.hpp:76
void draw(const CChart *_poChart, QPainter *_pqPainter)
Draws this overlay.
Definition: COverlay.cpp:86
bool bVisible
Overlay items' global visibility status.
Definition: COverlay.hpp:56
const QPen & getPenText() const
Definition: COverlay.hpp:124
const QPen & getPenMarkerSelected() const
Definition: COverlay.hpp:128
void forceRedraw()
Forces this overlay's rendering (not matter its cache content)
Definition: COverlay.hpp:115
const QPen & getPenVector() const
Definition: COverlay.hpp:130
virtual void setPosition(const QTreeWidgetItem *_pqTreeWidgetItem) const =0
Centers the chart on the given overlay object's position.
const QPen & getPenLine() const
Definition: COverlay.hpp:129
QString qsName
Overlay name.
Definition: COverlay.hpp:52
QPen qPenMarkerSelected
QPen used to identify selected markers on this overlay.
Definition: COverlay.hpp:88
QFont qFont
QFont used to draw text on this overlay.
Definition: COverlay.hpp:70
QBrush qBrushMarker
QBrush used to draw markers on this overlay.
Definition: COverlay.hpp:79
COverlay(const QString &_rqsName)
Definition: COverlay.cpp:36
bool isVisible() const
Returns this overlay items' global visibility status.
Definition: COverlay.hpp:120
const QBrush & getBrushMarkerSelected() const
Definition: COverlay.hpp:127
virtual void showDetail(const QTreeWidgetItem *_pqTreeWidgetItem) const =0
Displays the given overlay object's details (in the appropriate widget/view)
virtual COverlayPoint * matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const =0
Returns the overlay's point that (first) matches the given screen position (0 if none is found)
QBrush qBrushMarkerSelected
QBrush used to identify selected markers on this overlay.
Definition: COverlay.hpp:85
const QFont & getFont() const
Definition: COverlay.hpp:122
QPointF qPointFDatPositionPixmap
Chart position at which the last rendering was achieved.
Definition: COverlay.hpp:63
double fdZoomPixmap
Zoom factor at which the last rendering was achieved.
Definition: COverlay.hpp:65
QBrush qBrushText
QBrush used to draw text on this overlay.
Definition: COverlay.hpp:73
QPen qPenMarker
QPen used to draw markers on this overlay.
Definition: COverlay.hpp:82
const QPen & getPenMarker() const
Definition: COverlay.hpp:126