Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeControllerBase Class Referenceabstract

#include <KoShapeControllerBase.h>

+ Inheritance diagram for KoShapeControllerBase:

Public Member Functions

virtual KoShapeContainercreateParentForShapes (const QList< KoShape * > shapes, bool forceNewLayer, KUndo2Command *parentCommand)
 
QRectF documentRect () const
 
virtual QRectF documentRectInPixels () const =0
 
 KoShapeControllerBase ()
 
virtual qreal pixelsPerInch () const =0
 
virtual KoDocumentResourceManagerresourceManager () const
 
virtual ~KoShapeControllerBase ()
 

Private Attributes

KoshapeControllerBasePrivate *const d
 

Detailed Description

The KoshapeControllerBase is an abstract interface that the application's class that owns the shapes should implement. This tends to be the document.

See also
KoShapeDeleteCommand, KoShapeCreateCommand

Definition at line 30 of file KoShapeControllerBase.h.

Constructor & Destructor Documentation

◆ KoShapeControllerBase()

KoShapeControllerBase::KoShapeControllerBase ( )

Definition at line 48 of file KoShapeControllerBase.cpp.

◆ ~KoShapeControllerBase()

KoShapeControllerBase::~KoShapeControllerBase ( )
virtual

Definition at line 53 of file KoShapeControllerBase.cpp.

54{
55 delete d;
56}

References d.

Member Function Documentation

◆ createParentForShapes()

KoShapeContainer * KoShapeControllerBase::createParentForShapes ( const QList< KoShape * > shapes,
bool forceNewLayer,
KUndo2Command * parentCommand )
virtual

When shapes are dropped to the canvas, the document should decide, where to which parent to put them. In some cases the document should even create a special layer for the new shapes.

Returns
the proposed parent for shapes
Parameters
parentCommandthe command, which should be executed before the proposed parent will be added to the document (if new layer should be created)

Reimplemented in KisShapeController.

Definition at line 58 of file KoShapeControllerBase.cpp.

59{
60 Q_UNUSED(parentCommand);
61 Q_UNUSED(forceNewLayer);
62 Q_UNUSED(shapes);
63
64 return 0;
65}

◆ documentRect()

QRectF KoShapeControllerBase::documentRect ( ) const

The size of the document measured in 'pt'

Definition at line 72 of file KoShapeControllerBase.cpp.

73{
74 const qreal pxToPt = 72.0 / pixelsPerInch();
75
76 QTransform t = QTransform::fromScale(pxToPt, pxToPt);
77 return t.mapRect(documentRectInPixels());
78}
virtual qreal pixelsPerInch() const =0
virtual QRectF documentRectInPixels() const =0

References documentRectInPixels(), and pixelsPerInch().

◆ documentRectInPixels()

virtual QRectF KoShapeControllerBase::documentRectInPixels ( ) const
pure virtual

The size of the document measured in rasterized pixels. This information is needed for loading SVG documents that use 'px' as the default unit.

Implemented in KisShapeController.

◆ pixelsPerInch()

virtual qreal KoShapeControllerBase::pixelsPerInch ( ) const
pure virtual

Resolution of the rasterized representation of the document. Used to load SVG documents correctly.

Implemented in KisShapeController.

◆ resourceManager()

KoDocumentResourceManager * KoShapeControllerBase::resourceManager ( ) const
virtual

Return a pointer to the resource manager associated with the shape-set (typically a document). The resource manager contains document wide resources * such as variable managers, the image collection and others.

Definition at line 67 of file KoShapeControllerBase.cpp.

68{
69 return d->resourceManager;
70}
QPointer< KoDocumentResourceManager > resourceManager

References d, and KoshapeControllerBasePrivate::resourceManager.

Member Data Documentation

◆ d

KoshapeControllerBasePrivate* const KoShapeControllerBase::d
private

Definition at line 73 of file KoShapeControllerBase.h.


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