|
Krita Source Code Documentation
|
#include <KoToolFactoryBase.h>
Inheritance diagram for KoToolFactoryBase:Public Member Functions | |
| QString | activationShapeId () const |
| QList< QAction * > | createActions (KisKActionCollection *actionCollection) |
| virtual KoToolBase * | createTool (KoCanvasBase *canvas)=0 |
| 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 () |
Public Attributes | |
| QString | activationId |
| QString | iconName |
| const QString | id |
| int | priority |
| QString | section |
| QKeySequence | shortcut |
| QString | tooltip |
Protected Member Functions | |
| virtual QList< QAction * > | createActionsImpl () |
| createActionsImpl should be reimplemented if the tool needs any actions. The actions should have a valid objectName(). | |
| void | setActivationShapeId (const QString &activationShapeId) |
| void | setIconName (const char *iconName) |
| void | setIconName (const QString &iconName) |
| void | setPriority (int newPriority) |
| void | setSection (const QString §ion) |
| void | setShortcut (const QKeySequence &shortcut) |
| void | setToolTip (const QString &tooltip) |
Private Slots | |
| void | activateTool () |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
A factory for KoToolBase objects.
The baseclass for all tool plugins. Each plugin that ships a KoToolBase should also ship a factory. That factory will extend this class and set variable data like a toolTip and icon in the constructor of that extending class.
An example usage would be:
class MyToolFactory : public KoToolFactoryBase { public: MyToolFactory(const QStringList&) : KoToolFactoryBase("MyTool") { setToolTip(i18n("Create object")); setSection("main"); setPriority(5); } ~MyToolFactory() {} KoToolBase *createTool(KoCanvasBase *canvas); }; K_PLUGIN_FACTORY_WITH_JSON((MyToolFactoryFactory, "mytool.json", registerPlugin<MyToolFactory>();)
Definition at line 19 of file KoToolFactoryBase.cpp.
|
explicit |
Create the new factory
| id | a string that will be used internally for referencing the tool |
Definition at line 37 of file KoToolFactoryBase.cpp.
|
virtual |
|
privateslot |
Definition at line 208 of file KoToolFactoryBase.cpp.
References KoToolManager::instance(), and KoToolManager::switchToolRequested().
| QString KoToolFactoryBase::activationShapeId | ( | ) | const |
Return the id of the shape we can process. This is the shape Id the tool we create is associated with. So a TextTool for a TextShape.
Definition at line 158 of file KoToolFactoryBase.cpp.
References d.
| QList< QAction * > KoToolFactoryBase::createActions | ( | KisKActionCollection * | actionCollection | ) |
Create the actions for this tool. Actions are unique per window, not per tool instance; tool instances are unique per view/canvas.
Definition at line 47 of file KoToolFactoryBase.cpp.
References KisKActionCollection::action(), activateTool(), KisKActionCollection::addAction(), connect(), createActionsImpl(), debugFlake, id, KisActionRegistry::instance(), and KisActionRegistry::makeQAction().
|
protectedvirtual |
createActionsImpl should be reimplemented if the tool needs any actions. The actions should have a valid objectName().
Reimplemented in KoPathToolFactory, KisSelectionToolFactoryBase, KisToolPolyLineFactoryBase, KisToolPaintFactoryBase, KisToolBrushFactory, KisToolMoveFactory, DefaultToolFactory, ToolReferenceImagesFactory, KarbonCalligraphyToolFactory, KisToolSelectPolygonalFactory, KisToolSelectMagneticFactory, SvgTextToolFactory, and KisToolTransformFactory.
Definition at line 203 of file KoToolFactoryBase.cpp.
|
pure virtual |
Instantiate a new tool
| canvas | the canvas that the new tool will work on. Should be passed to the constructor of the tool. |
Implemented in KoPathToolFactory, KoZoomToolFactory, KisAssistantToolFactory, KisToolBrushFactory, KisToolColorSamplerFactory, KisToolEllipseFactory, KisToolFillFactory, KisToolGradientFactory, KisToolLineFactory, KisToolMeasureFactory, KisToolMoveFactory, KisToolMultiBrushFactory, KisToolPanFactory, KisToolPathFactory, KisToolPencilFactory, KisToolRectangleFactory, DefaultToolFactory, ToolReferenceImagesFactory, KarbonCalligraphyToolFactory, KisToolSelectContiguousFactory, KisToolSelectEllipticalFactory, KisToolSelectOutlineFactory, KisToolSelectPathFactory, KisToolSelectPolygonalFactory, KisToolSelectRectangularFactory, KisToolSelectSimilarFactory, KisToolSelectMagneticFactory, SvgTextToolFactory, KisToolCropFactory, KisToolDynaFactory, KisToolEncloseAndFillFactory, KisToolLazyBrushFactory, KisToolPolygonFactory, KisToolPolylineFactory, KisToolSmartPatchFactory, and KisToolTransformFactory.
| QString KoToolFactoryBase::iconName | ( | ) | const |
return the basename of the icon for this tool
| QString KoToolFactoryBase::id | ( | ) | const |
return the id for the tool this factory creates.
| int KoToolFactoryBase::priority | ( | ) | const |
Returns The priority of this tool in its section in the toolbox
|
inline |
Definition at line 22 of file KoToolFactoryBase.cpp.
| QString KoToolFactoryBase::section | ( | ) | const |
returns the section used to group tools in the toolbox
|
protected |
Set the id of the shape we can process. This is the Id, as passed to the constructor of a KoShapeFactoryBase, that the tool we create is associated with. This means that if a KoTextShape is selected, then all tools that have its id set here will be added to the dynamic part of the toolbox.
| activationShapeId | the Id of the shape |
Definition at line 168 of file KoToolFactoryBase.cpp.
References activationShapeId(), and d.
|
protected |
Set an icon to be used in the toolBox.
| iconName | the basename (without extension) of the icon |
Definition at line 183 of file KoToolFactoryBase.cpp.
|
protected |
|
protected |
Set the priority of this tool, as it is shown in the toolBox; lower number means it will be show more to the front of the list.
| newPriority | the priority |
Definition at line 193 of file KoToolFactoryBase.cpp.
References d.
|
protected |
Set the section used to group tools in the toolbox
| section | the section |
Definition at line 178 of file KoToolFactoryBase.cpp.
|
protected |
Set the default shortcut for activation of this tool.
Definition at line 198 of file KoToolFactoryBase.cpp.
|
protected |
Set the tooltip to be used for this tool
| tooltip | the tooltip |
Definition at line 173 of file KoToolFactoryBase.cpp.
| QKeySequence KoToolFactoryBase::shortcut | ( | ) | const |
Return the default keyboard shortcut for activation of this tool (if the shape this tool belongs to is active).
See KoToolManager for use.
| QString KoToolFactoryBase::toolTip | ( | ) | const |
return a translated tooltip Text
Definition at line 148 of file KoToolFactoryBase.cpp.
References d.
| QString KoToolFactoryBase::activationId |
Definition at line 30 of file KoToolFactoryBase.cpp.
|
private |
Definition at line 188 of file KoToolFactoryBase.h.
| QString KoToolFactoryBase::iconName |
Definition at line 31 of file KoToolFactoryBase.cpp.
| QString KoToolFactoryBase::id |
Definition at line 32 of file KoToolFactoryBase.cpp.
| int KoToolFactoryBase::priority |
Definition at line 27 of file KoToolFactoryBase.cpp.
| QString KoToolFactoryBase::section |
Definition at line 28 of file KoToolFactoryBase.cpp.
| QKeySequence KoToolFactoryBase::shortcut |
Definition at line 33 of file KoToolFactoryBase.cpp.
| QString KoToolFactoryBase::tooltip |
Definition at line 29 of file KoToolFactoryBase.cpp.