Scanframe Modular Application 0.1.0
|
Class for drawing a graph having optional rulers and grid. More...
#include <Graph.h>
Classes | |
struct | RulerInfo |
Holds information on the rulers. More... | |
Public Types | |
enum | EColor { cRulerText , cRulerLine , cGridLines , cRulerBackground , cGraphBackground , cGraphForeground } |
Colors enumeration of colors in the graph. More... | |
Public Member Functions | |
Graph (const QPalette &palette={}) | |
void | setRuler (Draw::ERulerOrientation ro, double start, double stop, int digits, const QString &unit) |
Sets and thus enabling the ruler for the passed orientation. | |
void | setGrid (Draw::EGridOrientation go, Draw::ERulerOrientation ro) |
Enables grid painting in the graph. | |
void | setBounds (const QFontMetrics &fontMetrics, const QRect &bounds) |
Sets the bounding rectangle for the graph for painting in. | |
const QRect & | paint (QPainter &painter, const QRect &bounds, const QRegion ®ion=null_ref< QRegion >()) |
Paints the graph. | |
void | paintPlotCross (QPainter &painter, const QString &text) |
Paints a cross with text in the plot area. Used when a plot can not be painted. | |
const QRect & | getPlotArea () const |
Gets the remaining area to plot the graph after rulers and grid have been painted. | |
void | setColor (EColor index, QColor color) |
Allows setting of individual indexed colors for the graph. | |
Public Attributes | |
bool | _debug {false} |
Draws only area bounds contours when enabled. | |
Protected Member Functions | |
RulerInfo * | getRulerInfo (Draw::ERulerOrientation ro) |
Gets the ruler information by orientation. | |
Protected Attributes | |
QVector< QColor > | _colors |
Holds the colors for painting the rulers en grid. | |
struct sf::Graph::RulerInfo | _top |
struct sf::Graph::RulerInfo | _left |
struct sf::Graph::RulerInfo | _right |
struct sf::Graph::RulerInfo | _bottom |
Draw::ERulerOrientation | _horizontal {Draw::roNone} |
Holds which ruler information is responsible. | |
Draw::ERulerOrientation | _vertical {Draw::roNone} |
QRect | _plotArea |
Holds the last calculated graph area rectangle. | |
Class for drawing a graph having optional rulers and grid.
This class uses sf::Draw
class for drawing a graph rulers and grid.
Use this class as a private class for a custom widget which produces a graph.
enum sf::Graph::EColor |
Colors enumeration of colors in the graph.
Used by setColor
function.
|
explicit |
Constructor passing a palette.
const QRect & sf::Graph::getPlotArea | ( | ) | const |
Gets the remaining area to plot the graph after rulers and grid have been painted.
|
protected |
Gets the ruler information by orientation.
ro | ruler orientation. |
const QRect & sf::Graph::paint | ( | QPainter & | painter, |
const QRect & | bounds, | ||
const QRegion & | region = null_ref< QRegion >() |
||
) |
Paints the graph.
Paints the graph passing the passed boundaries and the optional region when handling an event.
painter | Painter instance. |
bounds | Boundaries to paint in. |
region | Region in case of an event. |
void sf::Graph::paintPlotCross | ( | QPainter & | painter, |
const QString & | text | ||
) |
Paints a cross with text in the plot area. Used when a plot can not be painted.
painter | Painter instance. |
text | Text to paint in the middle in a rectangle. |
void sf::Graph::setBounds | ( | const QFontMetrics & | fontMetrics, |
const QRect & | bounds | ||
) |
Sets the bounding rectangle for the graph for painting in.
Paints the graph passing the passed boundaries and the optional region when handling an event.
fontMetrics | For calculating the ruler widths and heights. |
bounds | Boundary to paint in. |
void sf::Graph::setColor | ( | EColor | index, |
QColor | color | ||
) |
Allows setting of individual indexed colors for the graph.
index | Index of the color which is set. |
color | The specified color. |
void sf::Graph::setGrid | ( | Draw::EGridOrientation | go, |
Draw::ERulerOrientation | ro | ||
) |
Enables grid painting in the graph.
When painting this enables drawing grid for the passed orientation using the information of the passed ruler orientation.
go | Grid orientation |
ro | ruler orientation. |
void sf::Graph::setRuler | ( | Draw::ERulerOrientation | ro, |
double | start, | ||
double | stop, | ||
int | digits, | ||
const QString & | unit | ||
) |
Sets and thus enabling the ruler for the passed orientation.
ro | Orientation of the ruler. |
start | ruler start value. |
stop | ruler stop value. |
digits | Precision of the ruler values. |
unit | unit text of the ruler. |
|
protected |
|
protected |
Holds the colors for painting the rulers en grid.
bool sf::Graph::_debug {false} |
Draws only area bounds contours when enabled.
|
protected |
Holds which ruler information is responsible.
|
protected |
|
protected |
Holds the last calculated graph area rectangle.
|
protected |
|
protected |
|
protected |