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

#include <kis_selection_action_factories.h>

+ Inheritance diagram for KisShapesToVectorSelectionActionFactory:

Public Member Functions

 KisShapesToVectorSelectionActionFactory ()
 
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 98 of file kis_selection_action_factories.h.

Constructor & Destructor Documentation

◆ KisShapesToVectorSelectionActionFactory()

KisShapesToVectorSelectionActionFactory::KisShapesToVectorSelectionActionFactory ( )
inline

Definition at line 99 of file kis_selection_action_factories.h.

99: KisNoParameterActionFactory("shapes-to-vector-selection") {}

Member Function Documentation

◆ run()

void KisShapesToVectorSelectionActionFactory::run ( KisViewManager * view)
overridevirtual

Implements KisNoParameterActionFactory.

Definition at line 557 of file kis_selection_action_factories.cpp.

558{
559 const QList<KoShape*> originalShapes = view->canvasBase()->shapeManager()->selection()->selectedShapes();
560
561 bool hasSelectionShapes = false;
562 QList<KoShape*> clonedShapes;
563
564 Q_FOREACH (KoShape *shape, originalShapes) {
565 if (dynamic_cast<KisShapeSelectionMarker*>(shape->userData())) {
566 hasSelectionShapes = true;
567 continue;
568 }
569
570 clonedShapes << shape->cloneShapeAndBakeAbsoluteTransform();
571 }
572
573 if (clonedShapes.isEmpty()) {
574 if (hasSelectionShapes) {
575 view->showFloatingMessage(i18nc("floating message",
576 "The shape already belongs to a selection"),
577 QIcon(), 2000, KisFloatingMessage::Low);
578 }
579 return;
580 }
581
582 KisSelectionToolHelper helper(view->canvasBase(), kundo2_i18n("Convert shapes to vector selection"));
583 helper.addSelectionShapes(clonedShapes);
584}
KoShapeManager shapeManager
KisCanvas2 * canvasBase() const
Return the canvas base class.
void showFloatingMessage(const QString &message, const QIcon &icon, int timeout=4500, KisFloatingMessage::Priority priority=KisFloatingMessage::Medium, int alignment=Qt::AlignCenter|Qt::TextWordWrap)
shows a floating message in the top right corner of the canvas
const QList< KoShape * > selectedShapes() const
KoSelection * selection
KoShapeUserData * userData() const
Definition KoShape.cpp:710
KoShape * cloneShapeAndBakeAbsoluteTransform() const
creates a deep copy of the shape/shapes tree and bakes the absolute transform of this into the result...
Definition KoShape.cpp:207
KUndo2MagicString kundo2_i18n(const char *text)

References KisSelectionToolHelper::addSelectionShapes(), KisViewManager::canvasBase(), KoShape::cloneShapeAndBakeAbsoluteTransform(), kundo2_i18n(), KisFloatingMessage::Low, KoSelection::selectedShapes(), KoShapeManager::selection, KisCanvas2::shapeManager, KisViewManager::showFloatingMessage(), and KoShape::userData().


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