Worksheet

Top-level container for worksheet elements like plot, labels, etc.

Public Types

  • enum CartesianPlotActionMode

  • enum ExportArea

  • enum ExportFormat

  • enum Layout

  • enum Unit

  • enum ZoomFit

Public Methods

void

Worksheet(const QString &name, bool loading=false)

Background*

background() const

CartesianPlotActionMode

cartesianPlotActionMode() const

CartesianPlotActionMode

cartesianPlotCursorMode() const

double

convertFromSceneUnits(const double value, const Worksheet::Unit unit)

double

convertToSceneUnits(const double value, const Worksheet::Unit unit)

QMenu*

createContextMenu() override

WorksheetElement*

currentSelection()

TreeModel*

cursorModel()

void

cursorModelPlotAdded(const QString &name)

void

cursorModelPlotRemoved(const QString &name)

void

deleteAspectFromGraphicsItem(const QGraphicsItem *)

QVector< AbstractAspect* >

dependsOn() const override

bool

exportToFile(const QString &, const ExportFormat, const ExportArea area=ExportArea::Worksheet, const bool background=true, const int resolution=100) const

bool

exportView() const override

bool

exportView(QPixmap &) const

void

fillElementsContextMenu(QMenu *)

QIcon

icon() const override

bool

load(XmlStreamReader *, bool preview) override

QRectF

pageRect() const

QVector< AspectType >

pasteTypes() const override

CartesianPlot*

plot(int index)

int

plotCount()

bool

plotsInteractive() const

bool

printPreview() const override

bool

printView() override

void

registerShortcuts() override

void

save(QXmlStreamWriter *) const override

QGraphicsScene*

scene() const

void

setCartesianPlotActionMode(CartesianPlotActionMode mode)

void

setCartesianPlotCursorMode(CartesianPlotActionMode mode)

void

setInteractive(bool)

void

setIsClosing()

void

setItemSelectedInView(const QGraphicsItem *, const bool)

void

setPageRect(const QRectF &)

void

setPlotsInteractive(bool)

void

setPrinting(bool) const

void

setSuppressLayoutUpdate(bool)

void

suppressSelectionChangedEvent(bool)

QString

theme() const

void

unregisterShortcuts() override

void

update()

void

updateLayout()

QWidget*

view() const override

double

zoomFactor() const

Detailed Description

class Worksheet : public AbstractPart

Top-level container for worksheet elements like plot, labels, etc.

The worksheet is, besides the data containers Spreadsheet and Matrix, another central part of the application and provides an area for showing and grouping together different kinds of worksheet objects - plots, labels &etc;

Public Functions

virtual QIcon icon() const override

Return an icon to be used for decorating my views.

virtual QMenu *createContextMenu() override

Return a new context menu. The caller takes ownership of the menu.

void fillElementsContextMenu(QMenu*)

fills the context menu with actions for multiple selected elements for the context menu created in the Project Explorer, adding actions that can be applied for multiple selected elements.

virtual QWidget *view() const override

Construct a primary view on me.

This method may be called multiple times during the life time of an Aspect, or it might not get called at all. Aspects must not depend on the existence of a view for their operation.

virtual QVector<AbstractAspect*> dependsOn() const override

returns the list of all parent aspects (folders and sub-folders) together with all the data containers required to plot the data in the worksheet

virtual QVector<AspectType> pasteTypes() const override

return the list of all aspect types that can be copy&pasted into the current aspect. returns an empty list on default, needs to be re-implemented in all derived classes that want to allow other aspects to be pasted into.

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

void setItemSelectedInView(const QGraphicsItem*, const bool)

Emits the signal to select or to deselect the aspect corresponding to QGraphicsItem item in the project explorer, if selected=true or selected=false, respectively. The signal is handled in AspectTreeModel and forwarded to the tree view in ProjectExplorer. This function is called in WorksheetView upon selection changes.

int plotCount()

Worksheet::plotCount.

Returns:

number of CartesianPlot’s in the Worksheet

CartesianPlot *plot(int index)

Worksheet::plot.

Parameters:

index – Number of plot which should be returned

Returns:

Pointer to the CartesianPlot which was searched with index

Public Slots

void updateCurveBackground(QColor, const QString &curveName)

Updates the background of the curves entry in the treeview

Parameters:
  • pen – Pen of the curve

  • curveName – Curve name to find in treemodel

void updateCompleteCursorTreeModel()

Worksheet::updateCompleteCursorTreeModel If the plot or the curve are not available, the plot/curve is not in the treemodel!

void cursorPosChanged(int cursorNumber, double xPos)

Worksheet::cursorPosChanged Updates the cursor treemodel with the new data.

Parameters:

xPos – new position of the cursor It is assumed, that the plots/curves are in the same order than receiving from the children() function. It’s not checked if the names are the same

Public Static Functions

static double convertToSceneUnits(const double value, const Worksheet::Unit unit)

converts from unit to the scene units. At the moment, 1 scene unit corresponds to 1/10 mm.

static double convertFromSceneUnits(const double value, const Worksheet::Unit unit)

converts from the scene units to unit . At the moment, 1 scene unit corresponds to 1/10 mm.