#include <LegendWidget.h>
Public Types | |
enum | FrameStyle { None = 0, Line = 1, Shadow = 2 } |
The kinds of frame a LegendWidget can draw around the Text. More... | |
Signals | |
void | enableEditor () |
void | showDialog () |
void | showMenu () |
Public Member Functions | |
int | angle () |
QColor | backgroundColor () |
void | clone (LegendWidget *t) |
QFont | font () |
int | frameStyle () |
LegendWidget (Graph *) | |
void | move (const QPoint &pos) |
Graph * | plot () |
void | print (QPainter *p, const QwtScaleMap map[QwtPlot::axisCnt]) |
void | resetOrigin () |
void | setAngle (int ang) |
void | setBackgroundColor (const QColor &c) |
void | setFont (const QFont &font) |
void | setFrameStyle (int style) |
void | setOrigin (int x, int y) |
Sets the position of the top left corner in paint coordinates. | |
void | setOriginCoord (double x, double y) |
Sets the position of the top left corner in axis coordinates. | |
void | setText (const QString &s) |
void | setTextColor (const QColor &c) |
void | showContextMenu () |
void | showTextDialog () |
void | showTextEditor () |
QString | text () |
QColor | textColor () |
void | updateCoordinates () |
double | xValue () |
Returns the x axis coordiante of the top left corner. | |
double | yValue () |
Returns the y axis coordiante of the top left corner. | |
~LegendWidget () | |
Private Member Functions | |
double | calculateXValue () |
Returns the x axis coordinate of the top left corner based on the pixel value. | |
double | calculateYValue () |
Returns the y axis coordinate of the top left corner based on the pixel value. | |
void | contextMenuEvent (QContextMenuEvent *) |
void | drawFrame (QPainter *p, const QRect &rect) |
void | drawSymbol (PlotCurve *c, int point, QPainter *p, int x, int y, int l) |
void | drawText (QPainter *, const QRect &, QwtArray< long >, int) |
void | drawVector (PlotCurve *c, QPainter *p, int x, int y, int l) |
PlotCurve * | getCurve (const QString &s, int &point) |
QwtArray< long > | itemsHeight (int y, int symbolLineLength, int &width, int &height) |
void | mousePressEvent (QMouseEvent *) |
virtual void | paintEvent (QPaintEvent *e) |
QString | parse (const QString &str) |
int | symbolsMaxWidth () |
Private Attributes | |
int | d_angle |
Rotation angle: not implemented yet. | |
int | d_frame |
Frame type. | |
Graph * | d_plot |
Parent plot. | |
QwtText * | d_text |
Pointer to the QwtText object. | |
double | d_x |
X axis coordinate of the top left corner. | |
double | d_y |
Y axis coordinate of the top left corner. | |
int | h_space |
Distance between symbols and legend text. | |
int | left_margin |
Distance between frame and content. | |
int | line_length |
Length of the symbol line. | |
int | top_margin |
LegendWidget::LegendWidget | ( | Graph * | plot | ) |
References d_text, enableEditor(), h_space, left_margin, line_length, move(), showDialog(), showMenu(), and top_margin.
LegendWidget::~LegendWidget | ( | ) |
References d_text.
int LegendWidget::angle | ( | ) | [inline] |
QColor LegendWidget::backgroundColor | ( | ) | [inline] |
double LegendWidget::calculateXValue | ( | ) | [private] |
Returns the x axis coordinate of the top left corner based on the pixel value.
References d_plot.
Referenced by print(), and updateCoordinates().
double LegendWidget::calculateYValue | ( | ) | [private] |
Returns the y axis coordinate of the top left corner based on the pixel value.
References d_plot.
Referenced by print(), and updateCoordinates().
void LegendWidget::clone | ( | LegendWidget * | t | ) |
References angle(), backgroundColor(), d_angle, d_frame, font(), frameStyle(), setBackgroundColor(), setFont(), setOriginCoord(), setText(), setTextColor(), text(), textColor(), xValue(), and yValue().
Referenced by QwtPieCurve::addLabel(), Graph::addText(), and QwtPieCurve::removeLabel().
void LegendWidget::contextMenuEvent | ( | QContextMenuEvent * | ) | [inline, private] |
void LegendWidget::drawFrame | ( | QPainter * | p, | |
const QRect & | rect | |||
) | [private] |
void LegendWidget::drawSymbol | ( | PlotCurve * | c, | |
int | point, | |||
QPainter * | p, | |||
int | x, | |||
int | y, | |||
int | l | |||
) | [private] |
References Graph::Box, QwtPieCurve::color(), drawVector(), QwtPieCurve::pattern(), Graph::Pie, PlotCurve::type(), Graph::VectXYAM, and Graph::VectXYXY.
Referenced by drawText().
void LegendWidget::drawText | ( | QPainter * | p, | |
const QRect & | rect, | |||
QwtArray< long > | height, | |||
int | symbolLineLength | |||
) | [private] |
References Graph::antialiasing(), Graph::curve(), d_plot, d_text, drawSymbol(), getCurve(), h_space, left_margin, parse(), and text().
Referenced by paintEvent(), and print().
void LegendWidget::drawVector | ( | PlotCurve * | c, | |
QPainter * | p, | |||
int | x, | |||
int | y, | |||
int | l | |||
) | [private] |
References Graph::antialiasing(), VectorCurve::color(), d_plot, VectorCurve::filledArrowHead(), VectorCurve::headAngle(), VectorCurve::headLength(), and VectorCurve::width().
Referenced by drawSymbol().
void LegendWidget::enableEditor | ( | ) | [signal] |
Referenced by LegendWidget(), and showTextEditor().
QFont LegendWidget::font | ( | ) | [inline] |
References d_text.
Referenced by clone(), SelectionMoveResizer::operateOnTargets(), Graph::saveMarkers(), Graph::select(), and TextDialog::setLegendWidget().
int LegendWidget::frameStyle | ( | ) | [inline] |
PlotCurve * LegendWidget::getCurve | ( | const QString & | s, | |
int & | point | |||
) | [private] |
References Graph::curve(), d_plot, MultiLayer::layer(), and Graph::multiLayer().
Referenced by drawText(), and itemsHeight().
QwtArray< long > LegendWidget::itemsHeight | ( | int | y, | |
int | symbolLineLength, | |||
int & | width, | |||
int & | height | |||
) | [private] |
References d_text, getCurve(), h_space, left_margin, parse(), text(), and top_margin.
Referenced by paintEvent(), and print().
void LegendWidget::mousePressEvent | ( | QMouseEvent * | ) | [private] |
References Graph::activateGraph(), d_plot, Graph::deselectMarker(), and Graph::select().
void LegendWidget::move | ( | const QPoint & | pos | ) |
void LegendWidget::paintEvent | ( | QPaintEvent * | e | ) | [private, virtual] |
References d_frame, drawFrame(), drawText(), itemsHeight(), line_length, Shadow, and symbolsMaxWidth().
QString LegendWidget::parse | ( | const QString & | str | ) | [private] |
References Table::colIndex(), Graph::curve(), d_plot, Graph::Pie, Table::text(), and PlotCurve::type().
Referenced by drawText(), and itemsHeight().
Graph* LegendWidget::plot | ( | ) | [inline] |
void LegendWidget::print | ( | QPainter * | p, | |
const QwtScaleMap | map[QwtPlot::axisCnt] | |||
) |
References calculateXValue(), calculateYValue(), drawFrame(), drawText(), itemsHeight(), line_length, and symbolsMaxWidth().
void LegendWidget::resetOrigin | ( | ) | [inline] |
References d_x, d_y, and setOriginCoord().
void LegendWidget::setAngle | ( | int | ang | ) | [inline] |
void LegendWidget::setBackgroundColor | ( | const QColor & | c | ) |
References d_text.
Referenced by TextDialog::apply(), clone(), CanvasPicker::drawTextMarker(), TextDialog::formatAllLabels(), Graph::insertText(), Graph::newLegend(), and PieLabel::PieLabel().
void LegendWidget::setFont | ( | const QFont & | font | ) |
void LegendWidget::setFrameStyle | ( | int | style | ) |
References d_frame.
Referenced by ImportOPJ::addText(), TextDialog::apply(), CanvasPicker::drawTextMarker(), TextDialog::formatAllLabels(), Graph::insertText(), Graph::newLegend(), and PieLabel::PieLabel().
void LegendWidget::setOrigin | ( | int | x, | |
int | y | |||
) | [inline] |
void LegendWidget::setOriginCoord | ( | double | x, | |
double | y | |||
) |
Sets the position of the top left corner in axis coordinates.
References d_plot, d_x, and d_y.
Referenced by clone(), QwtPieCurve::drawDisk(), QwtPieCurve::drawSlices(), Graph::insertText(), and resetOrigin().
void LegendWidget::setText | ( | const QString & | s | ) |
References d_text.
Referenced by Graph::addLegendItem(), TextDialog::apply(), clone(), QwtPieCurve::drawDisk(), QwtPieCurve::drawSlices(), CanvasPicker::drawTextMarker(), ImportOPJ::importGraphs(), QwtPieCurve::initLabels(), Graph::insertText(), Graph::modifyFunctionCurve(), Graph::newLegend(), Differentiation::output(), Graph::plotBoxDiagram(), Graph::removeLegendItem(), and Graph::removePie().
void LegendWidget::setTextColor | ( | const QColor & | c | ) |
References d_text.
Referenced by ImportOPJ::addText(), TextDialog::apply(), clone(), CanvasPicker::drawTextMarker(), TextDialog::formatAllLabels(), Graph::insertText(), and Graph::newLegend().
void LegendWidget::showContextMenu | ( | ) | [inline] |
void LegendWidget::showDialog | ( | ) | [signal] |
Referenced by LegendWidget(), showTextDialog(), and showTextEditor().
void LegendWidget::showMenu | ( | ) | [signal] |
Referenced by LegendWidget(), and showContextMenu().
void LegendWidget::showTextDialog | ( | ) | [inline] |
void LegendWidget::showTextEditor | ( | ) |
int LegendWidget::symbolsMaxWidth | ( | ) | [private] |
References Graph::curve(), Graph::curveCount(), d_plot, d_text, and text().
Referenced by paintEvent(), and print().
QString LegendWidget::text | ( | ) | [inline] |
References d_text.
Referenced by Graph::addLegendItem(), clone(), Graph::createTable(), PieLabel::customText(), drawText(), itemsHeight(), Graph::modifyFunctionCurve(), SelectionMoveResizer::operateOnTargets(), Graph::removeLegendItem(), Graph::saveMarkers(), TextDialog::setLegendWidget(), symbolsMaxWidth(), and TextEditor::TextEditor().
QColor LegendWidget::textColor | ( | ) | [inline] |
void LegendWidget::updateCoordinates | ( | ) |
double LegendWidget::xValue | ( | ) | [inline] |
Returns the x axis coordiante of the top left corner.
References d_x.
Referenced by clone(), and Graph::saveMarkers().
double LegendWidget::yValue | ( | ) | [inline] |
Returns the y axis coordiante of the top left corner.
References d_y.
Referenced by clone(), and Graph::saveMarkers().
int LegendWidget::d_angle [private] |
int LegendWidget::d_frame [private] |
Graph* LegendWidget::d_plot [private] |
Parent plot.
Referenced by calculateXValue(), calculateYValue(), drawText(), drawVector(), getCurve(), mousePressEvent(), parse(), plot(), setOriginCoord(), showTextEditor(), and symbolsMaxWidth().
QwtText* LegendWidget::d_text [private] |
Pointer to the QwtText object.
Referenced by backgroundColor(), drawFrame(), drawText(), font(), itemsHeight(), LegendWidget(), setBackgroundColor(), setFont(), setText(), setTextColor(), symbolsMaxWidth(), text(), textColor(), and ~LegendWidget().
double LegendWidget::d_x [private] |
X axis coordinate of the top left corner.
Referenced by resetOrigin(), setOriginCoord(), updateCoordinates(), and xValue().
double LegendWidget::d_y [private] |
Y axis coordinate of the top left corner.
Referenced by resetOrigin(), setOriginCoord(), updateCoordinates(), and yValue().
int LegendWidget::h_space [private] |
Distance between symbols and legend text.
Referenced by drawText(), itemsHeight(), and LegendWidget().
int LegendWidget::left_margin [private] |
int LegendWidget::line_length [private] |
int LegendWidget::top_margin [private] |
Referenced by itemsHeight(), and LegendWidget().