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

#include <KoToolManager.h>

+ Inheritance diagram for KoToolAction:

Public Slots

void trigger ()
 Request the activation of the tool.
 

Signals

void changed ()
 Emitted when a property changes (shortcut ATM)
 

Public Member Functions

int buttonGroupId () const
 A unique ID for this tool as passed by changedTool(), >= 0.
 
QString iconName () const
 The icon name of the tool.
 
QString iconText () const
 The icontext of the tool.
 
QString id () const
 The id of the tool.
 
 KoToolAction (KoToolFactoryBase *toolFactory)
 
int priority () const
 Lower number (higher priority) means coming first in the section.
 
QString section () const
 The section the tool wants to be in.
 
QKeySequence shortcut () const
 The shortcut to activate the tool.
 
KoToolFactoryBasetoolFactory () const
 Factory to create new tool object instances.
 
QString toolTip () const
 The tooltip of the tool.
 
QString visibilityCode () const
 This tool should become visible when we Q_EMIT this string in toolCodesSelected()
 
 ~KoToolAction () override
 

Public Attributes

KoToolFactoryBasetoolFactory
 

Private Attributes

Private *const d
 
- Private Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Additional Inherited Members

- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Detailed Description

This class serves as a QAction-like control object for activation of a tool.

It allows to implement a custom UI to control the activation of tools. See KoToolBox & KoModeBox in the kowidgets library.

KoToolAction objects are owned by the KoToolManager singleton and live until the end of its lifetime.

Definition at line 40 of file KoToolManager.h.

Constructor & Destructor Documentation

◆ KoToolAction()

KoToolAction::KoToolAction ( KoToolFactoryBase * toolFactory)
explicit

Definition at line 23 of file KoToolManager_p.cpp.

24 : d(new Private)
25{
26 d->toolFactory = toolFactory;
27}
Private *const d
KoToolFactoryBase * toolFactory

References d, and toolFactory.

◆ ~KoToolAction()

KoToolAction::~KoToolAction ( )
override

Definition at line 29 of file KoToolManager_p.cpp.

30{
31 delete d;
32}

References d.

Member Function Documentation

◆ buttonGroupId()

int KoToolAction::buttonGroupId ( ) const

A unique ID for this tool as passed by changedTool(), >= 0.

◆ changed

void KoToolAction::changed ( )
signal

Emitted when a property changes (shortcut ATM)

◆ iconName()

QString KoToolAction::iconName ( ) const

The icon name of the tool.

Definition at line 56 of file KoToolManager_p.cpp.

57{
58 return d->toolFactory->iconName();
59}

References d.

◆ iconText()

QString KoToolAction::iconText ( ) const

The icontext of the tool.

Definition at line 40 of file KoToolManager_p.cpp.

41{
42 // There is no specific iconText in KoToolFactoryBase
43 return d->toolFactory->toolTip();
44}

References d.

◆ id()

QString KoToolAction::id ( ) const

The id of the tool.

Definition at line 51 of file KoToolManager_p.cpp.

52{
53 return d->toolFactory->id();
54}

References d.

◆ priority()

int KoToolAction::priority ( ) const

Lower number (higher priority) means coming first in the section.

Definition at line 72 of file KoToolManager_p.cpp.

73{
74 return d->toolFactory->priority();
75}

References d.

◆ section()

QString KoToolAction::section ( ) const

The section the tool wants to be in.

Definition at line 67 of file KoToolManager_p.cpp.

68{
69 return d->toolFactory->section();
70}

References d.

◆ shortcut()

QKeySequence KoToolAction::shortcut ( ) const

The shortcut to activate the tool.

Definition at line 61 of file KoToolManager_p.cpp.

62{
63 return d->toolFactory->shortcut();
64}

References d.

◆ toolFactory()

KoToolFactoryBase * KoToolAction::toolFactory ( ) const

Factory to create new tool object instances.

◆ toolTip()

QString KoToolAction::toolTip ( ) const

The tooltip of the tool.

Definition at line 46 of file KoToolManager_p.cpp.

47{
48 return d->toolFactory->toolTip();
49}

References d.

◆ trigger

void KoToolAction::trigger ( )
slot

Request the activation of the tool.

Definition at line 34 of file KoToolManager_p.cpp.

35{
37}
void switchToolRequested(const QString &id)
static KoToolManager * instance()
Return the toolmanager singleton.

References KoToolManager::instance(), and KoToolManager::switchToolRequested().

◆ visibilityCode()

QString KoToolAction::visibilityCode ( ) const

This tool should become visible when we Q_EMIT this string in toolCodesSelected()

Definition at line 77 of file KoToolManager_p.cpp.

78{
79 return d->toolFactory->activationShapeId();
80}

References d.

Member Data Documentation

◆ d

Private* const KoToolAction::d
private

Definition at line 69 of file KoToolManager.h.

◆ toolFactory

KoToolFactoryBase * KoToolAction::toolFactory

Definition at line 20 of file KoToolManager_p.cpp.


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