Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPasteShapeStyleActionFactory Struct Reference

#include <KisPasteActionFactories.h>

+ Inheritance diagram for KisPasteShapeStyleActionFactory:

Public Member Functions

 KisPasteShapeStyleActionFactory ()
 
void run (KisViewManager *view) override
 
- Public Member Functions inherited from KisNoParameterActionFactory
 KisNoParameterActionFactory (const QString &id)
 
void runFromXML (KisViewManager *view, const KisOperationConfiguration &config) override
 
- Public Member Functions inherited from KisOperation
QString id () const
 
 KisOperation (const QString &id)
 
virtual ~KisOperation ()
 

Additional Inherited Members

- Protected Member Functions inherited from KisOperation
KisProcessingApplicatorbeginAction (KisViewManager *view, const KUndo2MagicString &actionName)
 
void endAction (KisProcessingApplicator *applicator, const QString &xmlData)
 

Detailed Description

Definition at line 51 of file KisPasteActionFactories.h.

Constructor & Destructor Documentation

◆ KisPasteShapeStyleActionFactory()

KisPasteShapeStyleActionFactory::KisPasteShapeStyleActionFactory ( )
inline

Definition at line 52 of file KisPasteActionFactories.h.

52: KisNoParameterActionFactory("paste-shape-style-action") {}

Member Function Documentation

◆ run()

void KisPasteShapeStyleActionFactory::run ( KisViewManager * view)
overridevirtual

Implements KisNoParameterActionFactory.

Definition at line 429 of file KisPasteActionFactories.cpp.

430{
432
433 KisCanvas2 *canvas = view->canvasBase();
434
435 KoShapeManager *shapeManager = canvas->shapeManager();
436 QList<KoShape*> selectedShapes = shapeManager->selection()->selectedEditableShapes();
437
438 if (selectedShapes.isEmpty()) return;
439
440 if (paste.hasShapes()) {
441 KoCanvasBase *canvas = view->canvasBase();
442
443 QSizeF fragmentSize;
444 QList<KoShape*> shapes =
445 paste.fetchShapes(canvas->shapeController()->documentRectInPixels(),
446 canvas->shapeController()->pixelsPerInch(), &fragmentSize);
447
448 if (!shapes.isEmpty()) {
449 KoShape *referenceShape = shapes.first();
450
451
452 KUndo2Command *parentCommand = new KUndo2Command(kundo2_i18n("Paste Style"));
453
454 new KoShapeBackgroundCommand(selectedShapes, referenceShape->background(), parentCommand);
455 new KoShapeStrokeCommand(selectedShapes, referenceShape->stroke(), parentCommand);
456
457
458 canvas->addCommand(parentCommand);
459 }
460
461 qDeleteAll(shapes);
462 }
463}
KoShapeManager shapeManager
KisCanvas2 * canvasBase() const
Return the canvas base class.
QPointer< KoShapeController > shapeController
virtual void addCommand(KUndo2Command *command)=0
const QList< KoShape * > selectedEditableShapes() const
The undo / redo command for setting the shape background.
KoSelection * selection
The undo / redo command for setting the shape stroke.
virtual KoShapeStrokeModelSP stroke() const
Definition KoShape.cpp:1067
virtual QSharedPointer< KoShapeBackground > background() const
Definition KoShape.cpp:926
KUndo2MagicString kundo2_i18n(const char *text)
QAction * paste(const QObject *recvr, const char *slot, QObject *parent)

References KoCanvasBase::addCommand(), KoShape::background(), KisViewManager::canvasBase(), kundo2_i18n(), KoSelection::selectedEditableShapes(), KoShapeManager::selection, KoCanvasBase::shapeController, KisCanvas2::shapeManager, and KoShape::stroke().


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