Krita Source Code Documentation
Loading...
Searching...
No Matches
DefaultToolFactory Class Reference

Factory for the KoInteractionTool. More...

#include <DefaultToolFactory.h>

+ Inheritance diagram for DefaultToolFactory:

Public Member Functions

QList< QAction * > createActionsImpl () override
 createActionsImpl should be reimplemented if the tool needs any actions. The actions should have a valid objectName().
 
KoToolBasecreateTool (KoCanvasBase *canvas) override
 
 DefaultToolFactory ()
 constructor
 
 DefaultToolFactory (const QString &id)
 
 ~DefaultToolFactory () override
 
- Public Member Functions inherited from KoToolFactoryBase
QString activationShapeId () const
 
QList< QAction * > createActions (KisKActionCollection *actionCollection)
 
QString iconName () const
 
QString id () const
 
 KoToolFactoryBase (const QString &id)
 
int priority () const
 
 Private (const QString &i)
 
QString section () const
 
QKeySequence shortcut () const
 
QString toolTip () const
 
virtual ~KoToolFactoryBase ()
 

Additional Inherited Members

- Public Attributes inherited from KoToolFactoryBase
QString activationId
 
QString iconName
 
const QString id
 
int priority
 
QString section
 
QKeySequence shortcut
 
QString tooltip
 
- Protected Member Functions inherited from KoToolFactoryBase
void setActivationShapeId (const QString &activationShapeId)
 
void setIconName (const char *iconName)
 
void setIconName (const QString &iconName)
 
void setPriority (int newPriority)
 
void setSection (const QString &section)
 
void setShortcut (const QKeySequence &shortcut)
 
void setToolTip (const QString &tooltip)
 

Detailed Description

Factory for the KoInteractionTool.

Definition at line 14 of file DefaultToolFactory.h.

Constructor & Destructor Documentation

◆ DefaultToolFactory() [1/2]

DefaultToolFactory::DefaultToolFactory ( )

constructor

Definition at line 16 of file DefaultToolFactory.cpp.

18{
19 setToolTip(i18n("Select Shapes Tool"));
21 setPriority(0);
22 setIconName(koIconNameCStr("select"));
23 setActivationShapeId("flake/always");
24}
#define KoInteractionTool_ID
void setSection(const QString &section)
void setActivationShapeId(const QString &activationShapeId)
void setIconName(const char *iconName)
KoToolFactoryBase(const QString &id)
void setToolTip(const QString &tooltip)
void setPriority(int newPriority)
#define koIconNameCStr(name)
Definition kis_icon.h:28
static const QString Main
Tools that only work on vector shapes.

References koIconNameCStr, ToolBoxSection::Main, KoToolFactoryBase::setActivationShapeId(), KoToolFactoryBase::setIconName(), KoToolFactoryBase::setPriority(), KoToolFactoryBase::setSection(), and KoToolFactoryBase::setToolTip().

◆ DefaultToolFactory() [2/2]

DefaultToolFactory::DefaultToolFactory ( const QString & id)

Definition at line 26 of file DefaultToolFactory.cpp.

28{
29}

◆ ~DefaultToolFactory()

DefaultToolFactory::~DefaultToolFactory ( )
override

Definition at line 31 of file DefaultToolFactory.cpp.

32{
33}

Member Function Documentation

◆ createActionsImpl()

QList< QAction * > DefaultToolFactory::createActionsImpl ( )
overridevirtual

createActionsImpl should be reimplemented if the tool needs any actions. The actions should have a valid objectName().

Returns
the list of actions this tool wishes to be available.

Reimplemented from KoToolFactoryBase.

Reimplemented in ToolReferenceImagesFactory.

Definition at line 40 of file DefaultToolFactory.cpp.

41{
43
44 QList<QAction *> actions;
45 actions << actionRegistry->makeQAction("object_order_front", this);
46 actions << actionRegistry->makeQAction("object_order_raise", this);
47 actions << actionRegistry->makeQAction("object_order_lower", this);
48 actions << actionRegistry->makeQAction("object_order_back", this);
49 actions << actionRegistry->makeQAction("object_align_horizontal_left", this);
50 actions << actionRegistry->makeQAction("object_align_horizontal_center", this);
51 actions << actionRegistry->makeQAction("object_align_horizontal_right", this);
52 actions << actionRegistry->makeQAction("object_align_vertical_top", this);
53 actions << actionRegistry->makeQAction("object_align_vertical_center", this);
54 actions << actionRegistry->makeQAction("object_align_vertical_bottom", this);
55 actions << actionRegistry->makeQAction("object_distribute_horizontal_left", this);
56 actions << actionRegistry->makeQAction("object_distribute_horizontal_center", this);
57 actions << actionRegistry->makeQAction("object_distribute_horizontal_right", this);
58 actions << actionRegistry->makeQAction("object_distribute_horizontal_gaps", this);
59 actions << actionRegistry->makeQAction("object_distribute_vertical_top", this);
60 actions << actionRegistry->makeQAction("object_distribute_vertical_center", this);
61 actions << actionRegistry->makeQAction("object_distribute_vertical_bottom", this);
62 actions << actionRegistry->makeQAction("object_distribute_vertical_gaps", this);
63 actions << actionRegistry->makeQAction("object_group", this);
64 actions << actionRegistry->makeQAction("object_ungroup", this);
65 actions << actionRegistry->makeQAction("object_transform_rotate_90_cw", this);
66 actions << actionRegistry->makeQAction("object_transform_rotate_90_ccw", this);
67 actions << actionRegistry->makeQAction("object_transform_rotate_180", this);
68 actions << actionRegistry->makeQAction("object_transform_mirror_horizontally", this);
69 actions << actionRegistry->makeQAction("object_transform_mirror_vertically", this);
70 actions << actionRegistry->makeQAction("object_transform_reset", this);
71 actions << actionRegistry->makeQAction("object_unite", this);
72 actions << actionRegistry->makeQAction("object_intersect", this);
73 actions << actionRegistry->makeQAction("object_subtract", this);
74 actions << actionRegistry->makeQAction("object_split", this);
75
76 actions << actionRegistry->makeQAction("text_type_preformatted", this);
77 actions << actionRegistry->makeQAction("text_type_pre_positioned", this);
78 actions << actionRegistry->makeQAction("text_type_inline_wrap", this);
79
80 return actions;
81
82}
QAction * makeQAction(const QString &name, QObject *parent=0)
static KisActionRegistry * instance()

References KisActionRegistry::instance(), and KisActionRegistry::makeQAction().

◆ createTool()

KoToolBase * DefaultToolFactory::createTool ( KoCanvasBase * canvas)
overridevirtual

Instantiate a new tool

Parameters
canvasthe canvas that the new tool will work on. Should be passed to the constructor of the tool.
Returns
a new KoToolBase instance, or zero if the tool doesn't want to show up.

Implements KoToolFactoryBase.

Reimplemented in ToolReferenceImagesFactory.

Definition at line 35 of file DefaultToolFactory.cpp.

36{
37 return new DefaultTool(canvas, true);
38}
KisCanvas2 * canvas

References Private::canvas.


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