WorksheetElement

Base class for all Worksheet children.

Public Types

  • enum HorizontalAlignment

  • enum HorizontalPosition

  • enum Orientation

  • enum PositionLimit

  • enum VerticalAlignment

  • enum VerticalPosition

Public Methods

void

WorksheetElement(const QString &name, AspectType type)

QPointF

align(QPointF, QRectF, HorizontalAlignment, VerticalAlignment, bool positive) const

void

changed()

bool

coordinateBindingEnabled() const

void

coordinateBindingEnabledChanged(bool) const

int

coordinateSystemCount() const

int

coordinateSystemIndex() const

void

coordinateSystemIndexChanged(int) const

QString

coordinateSystemInfo(int index) const

QMenu*

createContextMenu() override

void

finalizeAdd() override

QGraphicsItem*

graphicsItem() const

void

handleResize(double horizontalRatio, double verticalRatio, bool pageResize=false)=0

void

horizontalAlignmentChanged(const WorksheetElement::HorizontalAlignment) const

void

hovered()

void

hoveredChanged(bool) const

bool

isFullyVisible() const

bool

isPrinting() const

bool

isVisible() const

bool

load(XmlStreamReader *, bool) override

void

loadThemeConfig(const KConfig &)

void

lockChanged(bool) const

QAction*

lockingAction()

void

objectPositionChanged()

QPointF

parentPosToRelativePos(QPointF parentPos, PositionWrapper) const

QRectF

parentRect() const

CartesianPlot*

plot() const

void

plotRangeListChanged()

void

positionChanged(const WorksheetElement::PositionWrapper &) const

void

positionLogicalChanged(QPointF) const

QPointF

relativePosToParentPos(PositionWrapper) const

void

rotationAngleChanged(qreal) const

void

rotationChanged(qreal) const

void

save(QXmlStreamWriter *) const override

void

saveThemeConfig(const KConfig &)

qreal

scale() const

bool

setCoordinateBindingEnabled(bool)

void

setCoordinateSystemIndex(int, QUndoCommand *parent=nullptr)

void

setParentGraphicsItem(QGraphicsItem *item)

void

setPositionInvalid(bool)

void

setPrinting(bool)

void

setSuppressRetransform(bool)

void

setVisible(bool on)

void

setZValue(qreal)

QPainterPath

shapeFromPath(const QPainterPath &, const QPen &)

void

unhovered()

void

updateLocale()

void

verticalAlignmentChanged(const WorksheetElement::VerticalAlignment) const

QAction*

visibilityAction()

void

visibleChanged(bool) const

Detailed Description

class WorksheetElement : public AbstractAspect

Base class for all Worksheet children.

Subclassed by Axis, CartesianPlotLegend, CustomPoint, Image, InfoElement, Plot, ReferenceLine, ReferenceRange, TextLabel, WorksheetElementContainer

Public Functions

void setPositionInvalid(bool)

position is set to invalid if the parent item is not drawn on the scene (e.g. axis is not drawn because it’s outside plot ranges -> don’t draw axis’ title label)

virtual QGraphicsItem *graphicsItem() const

Return the graphics item representing this element.

virtual void setParentGraphicsItem(QGraphicsItem *item)

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

Parameters:

item – parent graphicsitem

virtual void setVisible(bool on)

Show/hide the element.

virtual bool isVisible() const

Return whether the element is (at least) partially visible.

virtual bool isFullyVisible() const

Return whether the element is fully visible (i.e., including all child elements).

The standard implementation returns isVisible().

virtual void setPrinting(bool)

Switches the printing mode on/off.

QPointF parentPosToRelativePos(QPointF parentPos, PositionWrapper) const

parentPosToRelativePos Converts the absolute position of the element in parent coordinates into the distance between the alignment point of the parent and the element

Parameters:
  • parentPos – Element position in parent coordinates

  • parentRect – Parent data rect

  • rect – element’s rect

  • position – contains the alignment of the element to the parent

Returns:

distance between the parent position to the element

QPointF relativePosToParentPos(PositionWrapper) const

relativePosToParentPos

Parameters:
  • parentRect –

  • rect – element’s rect

  • position – contains the alignment of the element to the parent

Returns:

parent position

virtual QMenu *createContextMenu() override

Return a new context menu.

The caller takes ownership of the menu.

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool) 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

Public Static Functions

static QPainterPath shapeFromPath(const QPainterPath&, const QPen&)

This does exactly what Qt internally does to creates a shape from a painter path.

struct PositionWrapper