Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
CanvasSaveInfo Class Reference

Represents information needed to save and load a canvas state. More...

#include <canvas_info.h>

Public Member Functions

 CanvasSaveInfo ()
 Constructs a new CanvasSaveInfo object with default values.
qreal scale () const
 Returns the current scale of the canvas.
QPointF center () const
 Returns the center point of the canvas.
void setScale (qreal scale)
 Sets the scale of the canvas.
void setCenter (const QPointF &center)
 Sets the center point of the canvas.
QJsonObject toJson () const
 Converts the CanvasSaveInfo object to a JSON object.

Static Public Member Functions

static CanvasSaveInfo fromJson (const QJsonObject &data)
 Creates a CanvasSaveInfo object from a JSON object.

Private Attributes

QPointF mCenter = {0, 0}
 The scale of the canvas.

Friends

QDataStream & operator<< (QDataStream &out, const CanvasSaveInfo &info)
 Overloads the << operator to serialize a CanvasSaveInfo object to a QDataStream.
QDataStream & operator>> (QDataStream &in, CanvasSaveInfo &info)
 Overloads the >> operator to deserialize a CanvasSaveInfo object from a QDataStream.

Detailed Description

Represents information needed to save and load a canvas state.

Member Function Documentation

◆ center()

QPointF CanvasSaveInfo::center ( ) const

Returns the center point of the canvas.

Returns
The center point as a QPointF.

◆ fromJson()

CanvasSaveInfo CanvasSaveInfo::fromJson ( const QJsonObject & data)
static

Creates a CanvasSaveInfo object from a JSON object.

Parameters
dataThe QJsonObject containing the saved canvas information.
Returns
A new CanvasSaveInfo object initialized with the data.

◆ scale()

qreal CanvasSaveInfo::scale ( ) const

Returns the current scale of the canvas.

Returns
The scale value.

◆ setCenter()

void CanvasSaveInfo::setCenter ( const QPointF & center)

Sets the center point of the canvas.

Parameters
centerThe new center point as a QPointF.

◆ setScale()

void CanvasSaveInfo::setScale ( qreal scale)

Sets the scale of the canvas.

Parameters
scaleThe new scale value.

◆ toJson()

QJsonObject CanvasSaveInfo::toJson ( ) const

Converts the CanvasSaveInfo object to a JSON object.

Returns
A QJsonObject representing the current state of the canvas.

◆ operator<<

QDataStream & operator<< ( QDataStream & out,
const CanvasSaveInfo & info )
friend

Overloads the << operator to serialize a CanvasSaveInfo object to a QDataStream.

Parameters
outThe QDataStream to write to.
infoThe CanvasSaveInfo object to serialize.
Returns
A reference to the modified QDataStream.

◆ operator>>

QDataStream & operator>> ( QDataStream & in,
CanvasSaveInfo & info )
friend

Overloads the >> operator to deserialize a CanvasSaveInfo object from a QDataStream.

Parameters
inThe QDataStream to read from.
infoThe CanvasSaveInfo object to deserialize into.
Returns
A reference to the modified QDataStream.

The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/document/canvas_info.h
  • /__w/maki/maki/app/document/canvas_info.cpp