Worksheet Elements

These are objects that can be drawn on a worksheet or a worksheet element container.

class Image : public WorksheetElement

Worksheet element to draw images.

The image can be added to Worksheet or to CartesianPlot and is aligned relative to the specified position. The position can be either specified by providing the x- and y- coordinates in parent’s coordinate system, or by specifying one of the predefined position flags (HorizontalPosition, VerticalPosition).

Public Functions

virtual QIcon icon() const override

Returns an icon to be used in the project explorer.

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.

class InfoElement : public WorksheetElement

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

Public Functions

virtual void setParentGraphicsItem(QGraphicsItem *item) 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
class TextLabel : public WorksheetElement

A label supporting rendering of HTML, Markdown and LaTeX formatted texts.

The label is aligned relative to the specified position. The position can be either specified by providing the x- and y- coordinates in parent’s coordinate system, or by specifying one of the predefined position flags (HorizontalPosition, VerticalPosition).

Public Functions

virtual QIcon icon() const override

Returns an icon to be used in the project explorer.

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

struct GluePoint
struct TextWrapper

Public Members

bool allowPlaceholder = {false}

Determines if the Textlabel can have a placeholder or not. Depending on this variable in the LabelWidget between the text and the placeholder text can be switched