Schim
Public Member Functions | Friends | List of all members
SheetScene Class Reference

A specialized QGraphicsScene containing a sheet of paper. More...

#include <sheetscene.h>

Inheritance diagram for SheetScene:
[legend]
Collaboration diagram for SheetScene:
[legend]

Public Member Functions

 SheetScene (Sheet *sheet)
 Construct a scene based on the specified sheet. More...
 
QPointF getRawCursorPos () const
 Return the raw cursor position, before applying snap.
 
QPointF getCursorPos () const
 Return the processed cursor pos. More...
 
QPointF snap (const QPointF &pt) const
 Return the point on the grid that is closest to pt. More...
 
QPointF forcedSnap (const QPointF &pt) const
 Return the point on the grid that is closest to pt. More...
 
void setHeader (Header *hdr, bool destroy=true)
 Set the header in the scene and in the model. More...
 
void startOperation (SceneOperation *op)
 Start a scene operation. More...
 
void tryChangeHeader (Header *hdr, bool *changed=nullptr, bool *confirmed=nullptr)
 Try to set the sheet header to hdr and update the scene. More...
 

Friends

class SheetView
 
class GObject
 

Detailed Description

A specialized QGraphicsScene containing a sheet of paper.

Constructor & Destructor Documentation

◆ SheetScene()

SheetScene::SheetScene ( Sheet sheet)
explicit

Construct a scene based on the specified sheet.

Exceptions
std::logic_errorIf sheet is null.
Note
The scene does not take ownership of sheet.

Member Function Documentation

◆ forcedSnap()

QPointF SheetScene::forcedSnap ( const QPointF &  pt) const

Return the point on the grid that is closest to pt.

Both the argument and return value are in scene coordinates.

Note
In contrast to snap, this method returns the snapped position regardless of the enabled state of the snap feature.

◆ getCursorPos()

QPointF SheetScene::getCursorPos ( ) const

Return the processed cursor pos.

If snap is disabled the raw cursor position is returned. If snap is enabled, the snapped cursor position is returned.

See also
getCursorPos
getSnappedCursorPos

◆ setHeader()

void SheetScene::setHeader ( Header hdr,
bool  destroy = true 
)

Set the header in the scene and in the model.

Parameters
hdrThe new header.
destroyWhether to destroy the old header in the model.

◆ snap()

QPointF SheetScene::snap ( const QPointF &  pt) const

Return the point on the grid that is closest to pt.

Both the argument and return value are in scene coordinates.

Note
If snap is disabled, the parameter is returned unchanged.

◆ startOperation()

void SheetScene::startOperation ( SceneOperation op)

Start a scene operation.

The scene takes ownership of op, which must be dynamically allocated. Any active operations will be canceled.

◆ tryChangeHeader()

void SheetScene::tryChangeHeader ( Header hdr,
bool *  changed = nullptr,
bool *  confirmed = nullptr 
)

Try to set the sheet header to hdr and update the scene.

Parameters
hdrThe new header.
changed[Out] Whether the header has been changed.
confirmed[Out] Whether the user confirmed the change.
Note
The user is prompted for confirmation only if the sheet previously had a local header. If that is not the case, confirmed is true by default.

The documentation for this class was generated from the following file: