InfoElement

Marker which can highlight points of curves and show their values.

Public Methods

void

InfoElement(const QString &name, CartesianPlot *)

void

InfoElement(const QString &name, CartesianPlot *, const XYCurve *, double logicalPos)

void

addCurve(const XYCurve *, CustomPoint *=nullptr)

void

addCurvePath(const QString &curvePath, CustomPoint *=nullptr)

bool

assignCurve(const QVector< XYCurve * > &)

Line*

connectionLine() const

QMenu*

createContextMenu() override

TextLabel::TextWrapper

createTextLabelText()

int

currentIndex(double new_x, double *found_x=nullptr) const

void

curveDeleted(const AbstractAspect *)

TextLabel::GluePoint

gluePoint(int index) const

int

gluePointsCount() const

void

handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override

bool

isTextLabel() const

bool

isValid() const

bool

load(XmlStreamReader *, bool preview) override

void

loadThemeConfig(const KConfig &) override

MarkerPoints_T

markerPointAt(int index) const

int

markerPointsCount() const

void

removeCurve(const XYCurve *)

void

retransform() override

void

save(QXmlStreamWriter *) const override

double

setMarkerpointPosition(double x)

void

setParentGraphicsItem(QGraphicsItem *) override

void

setVisible(bool on) override

void

setZValue(qreal) override

TextLabel*

title()

Line*

verticalLine() const

Detailed Description

class InfoElement : public WorksheetElement

Marker which can highlight points of curves and show their values.

Public Functions

virtual void setParentGraphicsItem(QGraphicsItem*) override

WorksheetElement::setParentGraphicsItem Sets the parent graphicsitem, needed for binding to coord.

Parameters:

item – parent graphicsitem

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

XmlStreamReader supports errors as well as warnings. If only warnings (non-critical errors) occur, this function must return the reader at the end element corresponding to the current element at the time the function was called.

This function is normally intended to be called directly after the ctor. If you want to call load on an aspect that has been altered, you must make sure beforehand that it is in the same state as after creation, e.g., remove all its child aspects.

Returns:

false on error

void addCurve(const XYCurve*, CustomPoint* = nullptr)

InfoElement::addCurve Adds a new markerpoint to the plot which is placed on the curve curve.

Parameters:
  • curve – Curve on which the markerpoints sits

  • custompoint – Use existing point, if the project was loaded the custompoint can have different settings

void addCurvePath(const QString &curvePath, CustomPoint* = nullptr)

InfoElement::addCurvePath When loading infoelement from xml file, there is no information available, which curves are loaded. So only the path will be stored and after all curves where loaded the curves will be assigned to the InfoElement with the function assignCurve Assumption: if custompoint!=nullptr then the custompoint was already added to the InfoElement previously. Here only new created CustomPoints will be added to the InfoElement.

Parameters:
  • curvePath – path from the curve

  • custompoint – adding already created custom point

bool assignCurve(const QVector<XYCurve*>&)

assignCurve Finds the curve with the path stored in the markerpoints and assigns the pointer to markerpoints

Parameters:

curves –

Returns:

true if all markerpoints are assigned with a curve, false if one or more markerpoints don’t have a curve assigned

void removeCurve(const XYCurve*)

Remove markerpoint from a curve

Parameters:

curve –

virtual void setZValue(qreal) override

Set the z value of the m_title and the custompoints higher than the infoelement

Parameters:

value –

int markerPointsCount() const

Returns the amount of markerpoints. Used in the InfoElementDock to fill listWidget.

MarkerPoints_T markerPointAt(int index) const

Returns the Markerpoint at index index. Used in the InfoElementDock to fill listWidget

Parameters:

index –

TextLabel::TextWrapper createTextLabelText()

create Text which will be shown in the TextLabel Called when:

  • The position of the infoelement was changed

  • a curve was removed

  • a curve was added

Returns:

Text

virtual QMenu *createContextMenu() override

Return a new context menu.

The caller takes ownership of the menu.

int currentIndex(double new_x, double *found_x = nullptr) const

InfoElement::currentValue Calculates the new x position from.

Parameters:

new_x –

Returns:

virtual void setVisible(bool on) override

Show/hide the element.

Public Slots

void labelPositionChanged(TextLabel::PositionWrapper)

Will be called, when the label changes his position

Parameters:

position –

void pointPositionChanged(const PositionWrapper&)

Will be called, when the customPoint changes his position

Parameters:

pos –

void childRemoved(const AbstractAspect *parent, const AbstractAspect *before, const AbstractAspect *child)

Delete child and remove from markerpoint list if it is a markerpoint. If it is a textlabel delete complete InfoElement

struct MarkerPoints_T