|
libkpl
6.0
A Library for Graphical Presentation of Data Sets and Functions
|
Legend item class. More...
#include <legenditem.h>

Public Types | |
| enum | { Type = UserType + Legend } |
| Specific QGraphicsItem type number for function type() More... | |
Public Types inherited from KplItem | |
| enum | FillStyle { NoBrush , SolidPattern , HorPattern , VerPattern , CrossPattern , BDiagPattern , FDiagPattern , DiagCrossPattern } |
| Fill styles. More... | |
| enum | ItemType { Frame = 1 , Array , Function , ParFunction , Spline , Array3D , Function3D , Legend , Text , Line , Arrow , Arc , Rectangle , Ellipse , Image , ScaleBar } |
| Item types. More... | |
| enum | PenType { FramePen , GridPen , DataPen } |
| Pen types. More... | |
| enum | Symbol { Invisible = -17 , FilledOctagon , FilledHourglass , FilledTriangle , FilledSquare , FilledDiamond , FilledCircle , Umbrella , Ypsilon , Plus , Cross , OpenOctagon , OpenHourglass , OpenTriangle , OpenSquare , OpenDiamond , Dot , OpenCircle , SolidLine , DashLine1 , DashLine2 , DotLine1 , DashLine3 , DashDotLine , DashLine4 , DashLine5 , DotLine2 } |
| Symbol types. More... | |
Public Member Functions | |
| LegendItem (double x0=0, double y0=0, unsigned colorSymbol=0, unsigned colorText=0, Symbol symbol=SolidLine, double xOff=1, double yOff=0, QGraphicsItem *parent=nullptr, const QString &text=QString(), bool visible=true, double relSize=1, double symbolSize=1) | |
| Constructor. | |
| LegendItem (const LegendItem &a) | |
| Copy constructor. | |
| LegendItem (const KConfigGroup *plo, unsigned colorSymbol, unsigned colorText, Symbol symbol, double frameWidth, QGraphicsItem *parent=nullptr) | |
| Constructor. | |
| virtual | ~LegendItem () |
| Destructor. | |
| virtual QRectF | boundingRect () const override |
| Calculates bounding rectangle. | |
| virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override |
| Paints item. | |
| QPixmap | pixmap () const |
| Returns decoration pixmap for item list. | |
| void | setProperties (const QTransform &m) |
| Sets properties according to transformation matrix. | |
| void | setSize () |
| Sets size according to transformation matrix. | |
| void | setSymbol (Symbol symbol) |
| Sets symbol type. | |
| void | setSymbolSize (double symbolSize) |
| Sets symbol size. | |
| void | setText (const QString &text) |
| Sets text. | |
| void | setTextColor (unsigned color) |
| Sets text color. | |
| void | setTextX (double x) |
| Sets x offset for text. | |
| void | setTextY (double y) |
| Sets y offset for text. | |
| Symbol | symbol () const |
| Returns symbol type. | |
| double | symbolSize () const |
| Returns relative symbol size. | |
| QString | text () const |
| Returns text. | |
| unsigned | textColor () const |
| Returns text color. | |
| double | textX () const |
| Returns x offset for text in cm. | |
| double | textY () const |
| Returns y offset for text in cm. | |
| virtual int | type () const override |
| Returns specific QGraphicsItem type number. | |
| void | update () |
| Applies changes and forces redrawing. | |
| void | writePlo (KConfigGroup *plo) const |
| Writes into plot file. | |
Public Member Functions inherited from DecoItem | |
| DecoItem (unsigned color=0, double x0=0, double y0=0, double relSize=1) | |
| Constructor. | |
| DecoItem (const KConfigGroup *plo, unsigned color=0) | |
| Constructor. | |
| virtual | ~DecoItem () |
| Destructor. | |
| unsigned | color () const |
| Returns color. | |
| void | setColor (unsigned color) |
| Sets color. | |
| void | setX0 (double x0) |
| Sets x position. | |
| void | setY0 (double y0) |
| Sets y position. | |
| void | updatePos (const QPointF &p, bool absolute=true) |
| Updates position. | |
| void | writePlo (KConfigGroup *plo, bool visible) const |
| Writes into plot file. | |
| double | x0 () const |
| Returns x position in cm. | |
| double | y0 () const |
| Returns y position in cm. | |
Public Member Functions inherited from KplItem | |
| KplItem (double relSize=1) | |
| Constructor. | |
| KplItem (const KplItem &a) | |
| Copy constructor. | |
| KplItem (const KConfigGroup *plo) | |
| Constructor. | |
| virtual | ~KplItem () |
| Destructor. | |
| void | readPlo (const KConfigGroup *plo) |
| Initializes corresponding to plot file. | |
| double | relSize () const |
| Returns relative size of item. | |
| void | setRelSize (double relSize) |
| Sets relative size of item. | |
| void | writePlo (KConfigGroup *plo, bool visible=true) const |
| Writes into plot file. | |
Protected Member Functions | |
| void | init () |
| Performs initialization. | |
| virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
| Updates position. | |
| void | setProperties () |
| Sets properties according to transformation matrix. | |
| QRectF | textRect () const |
| Returns text rectangle. | |
Protected Member Functions inherited from KplItem | |
| QPen & | changePenWidth (QPen &pen, double width) const |
| Changes pen width. | |
| QPen | createPen (QGraphicsItem *item, unsigned color=0, PenType penType=DataPen, Symbol symbol=SolidLine) const |
| Creates pen for plot item. | |
| double | penWidth (const QGraphicsItem *item, PenType penType=DataPen) const |
| Calculates pen width for plot item. | |
Protected Attributes | |
| Symbol | m_symbol |
| unsigned | m_textColor |
| double | m_textX |
| double | m_textY |
| double | m_symbolSize |
| QString | m_text |
| QTextDocument | m_doc |
| QPen | m_pen |
| QRectF | symbRect |
Protected Attributes inherited from DecoItem | |
| unsigned | m_color |
| double | m_x0 |
| double | m_y0 |
| QTransform | m_matrix |
Protected Attributes inherited from KplItem | |
| double | m_relSize |
Additional Inherited Members | |
Static Public Member Functions inherited from KplItem | |
| static QUrl | absoluteUrl (const QString &path, const QUrl &urlPlo) |
| Constructs absolute file URL. | |
| static QBrush | createBrush (unsigned color, FillStyle fillStyle=NoBrush) |
| Creates brush. | |
| static QPen | createPen (double width, unsigned color, PenType penType, Symbol symbol) |
| Creates pen. | |
| static void | paintSymbol (QPainter *painter, const QRectF &rect, Symbol symbol=OpenCircle) |
| Paints symbol. | |
| static QPixmap | pixmap (Symbol symbol) |
| Returns black decoration pixmap of plot symbol for use in dialog GUI. | |
| static QPixmap | pixmap (QPen pen, Symbol symbol=SolidLine) |
| Returns decoration pixmap of plot symbol for use in item lists. | |
| static QString | path (const QUrl &urlPlo, const QUrl &url, bool absolute=false) |
| Constructs absolute or (if possible) relative file path. | |
| static void | resetDashOffset () |
| Resets offset for dashed lines. | |
| static unsigned | rgb (const QString &color) |
| Converts rgb string to QRgb. | |
| static unsigned | rgbQt1 (unsigned rgb) |
| Converts QRgb to Qt1 QRgb. | |
Static Protected Member Functions inherited from KplItem | |
| static double | parentWidth (const QGraphicsItem *item) |
| Returns width of item's parent frame or width of scene if the item has no parent item. | |
| static double | penWidthFactor (PenType penType) |
| Returns factor to calculate pen width from frame width. | |
Static Protected Attributes inherited from KplItem | |
| static double | m_dashOffset |
Legend item class.
Class for legends items explaining markers and line types.
| anonymous enum |
Specific QGraphicsItem type number for function type()
| Enumerator | |
|---|---|
| Type | Specific QGraphicsItem type number of LegendItem for function type(). |
| LegendItem::LegendItem | ( | double | x0 = 0, |
| double | y0 = 0, | ||
| unsigned | colorSymbol = 0, | ||
| unsigned | colorText = 0, | ||
| Symbol | symbol = SolidLine, | ||
| double | xOff = 1, | ||
| double | yOff = 0, | ||
| QGraphicsItem * | parent = nullptr, | ||
| const QString & | text = QString(), | ||
| bool | visible = true, | ||
| double | relSize = 1, | ||
| double | symbolSize = 1 ) |
Constructor.
Initializes corresponding to arguments.
| x0 | x position in cm. |
| y0 | y position in cm. |
| colorSymbol | color for marker or line. |
| colorText | color for text. |
| symbol | symbol type. |
| xOff | x offset for text in cm. |
| yOff | y offset for text in cm. |
| parent | pointer to parent item. |
| text | legend text. |
| visible | true for visible item. |
| relSize | relative size of text. |
| symbolSize | relative size of symbol. |
| LegendItem::LegendItem | ( | const LegendItem & | a | ) |
Copy constructor.
| a | source item. |
| LegendItem::LegendItem | ( | const KConfigGroup * | plo, |
| unsigned | colorSymbol, | ||
| unsigned | colorText, | ||
| Symbol | symbol, | ||
| double | frameWidth, | ||
| QGraphicsItem * | parent = nullptr ) |
Constructor.
Initializes corresponding to plot file.
| plo | pointer to KSimpleConfig object containing item data. |
| colorSymbol | default color for marker or line. |
| colorText | default color for text. |
| symbol | default symbol type. |
| frameWidth | frame width in cm. |
| parent | pointer to parent item. |
| void LegendItem::setProperties | ( | const QTransform & | m | ) |
Sets properties according to transformation matrix.
| m | transformation matrix. |
|
inline |
Sets symbol type.
| symbol | symbol type. |
|
inline |
Sets symbol size.
| symbolSize | relative size. |
|
inline |
Sets text.
| text | text. |
|
inline |
Sets text color.
| color | color. |
|
inline |
Sets x offset for text.
| x | x offset for text in cm. |
|
inline |
Sets y offset for text.
| y | y offset for text in cm. |
| void LegendItem::writePlo | ( | KConfigGroup * | plo | ) | const |
Writes into plot file.
| plo | KConfigGroup object. |