|
Krita Source Code Documentation
|
#include <KoCanvasResourceProvider.h>
Inheritance diagram for KoCanvasResourceProvider:Public Types | |
| enum | ApplicationSpecial { NoSpecial = 0 , NoAdvancedText = 1 } |
Public Slots | |
| void | setAbstractResource (KoAbstractCanvasResourceInterfaceSP abstractResource) |
| void | setResource (int key, const KoColor &color) |
| void | setResource (int key, const KoUnit &unit) |
| void | setResource (int key, const QVariant &value) |
| void | setResource (int key, KoShape *shape) |
Signals | |
| void | canvasResourceChangeAttempted (int key, const QVariant &value) |
| void | canvasResourceChanged (int key, const QVariant &value) |
Public Attributes | |
| QSharedPointer< CanvasResourceProviderInterfaceWrapper > | interfaceWrapper |
| KoResourceManager | manager |
Private Member Functions | |
| KoCanvasResourceProvider (const KoCanvasResourceProvider &) | |
| KoCanvasResourceProvider & | operator= (const KoCanvasResourceProvider &) |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
The KoCanvasResourceProvider contains a set of per-canvas properties, like current foreground color, current background color and more. All tools belonging to the current canvas are notified when a Resource changes (is set).
The manager can contain all sorts of variable types and there are accessors for the most common ones. All variables are always stored inside a QVariant instance internally and you can always just use the resource() method to get that directly. The way to store arbitrary data objects that are stored as pointers you can use the following code snippets;
Definition at line 37 of file KoCanvasResourceProvider.cpp.
| Enumerator | |
|---|---|
| NoSpecial | |
| NoAdvancedText | |
Definition at line 58 of file KoCanvasResourceProvider.h.
|
explicit |
Constructor.
| parent | the parent QObject, used for memory management. |
Definition at line 49 of file KoCanvasResourceProvider.cpp.
References canvasResourceChangeAttempted(), canvasResourceChanged(), connect(), d, KoColorSpaceRegistry::instance(), KoResourceManager::resourceChangeAttempted(), KoResourceManager::resourceChanged(), KoColorSpaceRegistry::rgb8(), setBackgroundColor(), and setForegroundColor().
|
override |
|
private |
| void KoCanvasResourceProvider::addActiveCanvasResourceDependency | ( | KoActiveCanvasResourceDependencySP | dep | ) |
Definition at line 245 of file KoCanvasResourceProvider.cpp.
References d.
| void KoCanvasResourceProvider::addDerivedResourceConverter | ( | KoDerivedResourceConverterSP | converter | ) |
Definition at line 205 of file KoCanvasResourceProvider.cpp.
References d.
| void KoCanvasResourceProvider::addResourceUpdateMediator | ( | KoResourceUpdateMediatorSP | mediator | ) |
Definition at line 230 of file KoCanvasResourceProvider.cpp.
References d.
| KoColor KoCanvasResourceProvider::backgroundColor | ( | ) | const |
Return the backgroundColor
Definition at line 119 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::BackgroundColor, and koColorResource().
| bool KoCanvasResourceProvider::boolResource | ( | int | key | ) | const |
Return the resource determined by param key as a boolean.
| key | the identifying key for the resource |
Definition at line 175 of file KoCanvasResourceProvider.cpp.
References d.
|
signal |
This signal is emitted every time a resource is attempted to be changed. The this signal is emitted even when the new value of the resource is the same as the current value. This method is called before the actual change has happened at the resource manager.
| key | the identifying key for the resource |
| value | the variants new value. |
|
signal |
This signal is emitted every time a resource is set that is either new or different from the previous set value.
| key | the identifying key for the resource |
| value | the variants new value. |
| KoCanvasResourcesInterfaceSP KoCanvasResourceProvider::canvasResourcesInterface | ( | ) | const |
An interface for accessing this KoCanvasResourceProvider via KoCanvasResourcesInterface.
Definition at line 265 of file KoCanvasResourceProvider.cpp.
References d.
| void KoCanvasResourceProvider::clearResource | ( | int | key | ) |
Remove the resource with key from the provider.
| key | the key that will be used to remove the resource There will be a signal emitted with a variable that will return true on QVariable::isNull(); |
Definition at line 200 of file KoCanvasResourceProvider.cpp.
References d.
| int KoCanvasResourceProvider::decorationThickness | ( | ) | const |
decorationThickness
Definition at line 156 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::DecorationThickness, hasResource(), and intResource().
| KoColor KoCanvasResourceProvider::foregroundColor | ( | ) | const |
Return the foregroundColor
Definition at line 109 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::ForegroundColor, and koColorResource().
| int KoCanvasResourceProvider::handleRadius | ( | ) | const |
Returns the actual handle radius.
Definition at line 142 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::HandleRadius, hasResource(), and intResource().
| bool KoCanvasResourceProvider::hasAbstractResource | ( | int | key | ) |
Definition at line 220 of file KoCanvasResourceProvider.cpp.
References d.
| bool KoCanvasResourceProvider::hasActiveCanvasResourceDependency | ( | int | sourceKey, |
| int | targetKey ) const |
Definition at line 250 of file KoCanvasResourceProvider.cpp.
References d.
| bool KoCanvasResourceProvider::hasDerivedResourceConverter | ( | int | key | ) |
Definition at line 210 of file KoCanvasResourceProvider.cpp.
References d.
| bool KoCanvasResourceProvider::hasResource | ( | int | key | ) | const |
Returns true if there is a resource set with the requested key.
| key | the identifying key for the resource |
Definition at line 195 of file KoCanvasResourceProvider.cpp.
References d.
| bool KoCanvasResourceProvider::hasResourceUpdateMediator | ( | int | key | ) |
Definition at line 235 of file KoCanvasResourceProvider.cpp.
References d.
| int KoCanvasResourceProvider::intResource | ( | int | key | ) | const |
Return the resource determined by param key as an integer.
| key | the identifying key for the resource |
Definition at line 180 of file KoCanvasResourceProvider.cpp.
References d.
| bool KoCanvasResourceProvider::isUsingOtherColor | ( | ) | const |
isUsingOtherColor
Definition at line 168 of file KoCanvasResourceProvider.cpp.
References boolResource(), hasResource(), and KoCanvasResource::UsingOtherColor.
| KoColor KoCanvasResourceProvider::koColorResource | ( | int | key | ) | const |
Return the resource determined by param key as a KoColor.
| key | the identifying key for the resource |
Definition at line 99 of file KoCanvasResourceProvider.cpp.
References d.
| KoShape * KoCanvasResourceProvider::koShapeResource | ( | int | key | ) | const |
Return the resource determined by param key as a pointer to a KoShape.
| key | the identifying key for the resource |
Definition at line 124 of file KoCanvasResourceProvider.cpp.
References d.
|
private |
|
inline |
Definition at line 40 of file KoCanvasResourceProvider.cpp.
| void KoCanvasResourceProvider::removeAbstractResource | ( | int | key | ) |
Definition at line 225 of file KoCanvasResourceProvider.cpp.
References d.
| void KoCanvasResourceProvider::removeActiveCanvasResourceDependency | ( | int | sourceKey, |
| int | targetKey ) |
Definition at line 255 of file KoCanvasResourceProvider.cpp.
References d.
| void KoCanvasResourceProvider::removeDerivedResourceConverter | ( | int | key | ) |
Definition at line 215 of file KoCanvasResourceProvider.cpp.
References d.
| void KoCanvasResourceProvider::removeResourceUpdateMediator | ( | int | key | ) |
Definition at line 240 of file KoCanvasResourceProvider.cpp.
References d.
| QVariant KoCanvasResourceProvider::resource | ( | int | key | ) | const |
Returns a qvariant containing the specified resource or a standard one if the specified resource does not exist.
| key | the key |
Definition at line 73 of file KoCanvasResourceProvider.cpp.
References d.
|
slot |
Replace an existing existing derived or abstract resource with a new abstract resource.
Definition at line 260 of file KoCanvasResourceProvider.cpp.
References d.
Set the backgroundColor resource.
| color | the new background color |
Definition at line 114 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::BackgroundColor, and setResource().
| void KoCanvasResourceProvider::setDecorationThickness | ( | int | decorationThickness | ) |
setDecorationThickness Set the minimum decoration thickness.
| decorationThickness | the minimum decoration thickness in pixels. |
Definition at line 149 of file KoCanvasResourceProvider.cpp.
References decorationThickness(), KoCanvasResource::DecorationThickness, and setResource().
Set the foregroundColor resource.
| color | the new foreground color |
Definition at line 104 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::ForegroundColor, and setResource().
| void KoCanvasResourceProvider::setHandleRadius | ( | int | handleSize | ) |
Tools that provide a handle for controlling the content that the tool can edit can use this property to alter the radius that a circular handle should have on screen.
| handleSize | the radius in pixels. |
Definition at line 134 of file KoCanvasResourceProvider.cpp.
References KoCanvasResource::HandleRadius, and setResource().
Set a resource of type KoColor.
| key | the integer key |
| color | the new value for the key. |
Definition at line 78 of file KoCanvasResourceProvider.cpp.
References setResource(), and v.
Set a resource of type KoUnit
| key | the integer key |
| id | the new value for the key. |
Definition at line 92 of file KoCanvasResourceProvider.cpp.
References setResource(), and v.
|
slot |
Set a resource of any type.
| key | the integer key |
| value | the new value for the key. |
Definition at line 68 of file KoCanvasResourceProvider.cpp.
Set a resource of type KoShape*.
| key | the integer key |
| id | the new value for the key. |
Definition at line 85 of file KoCanvasResourceProvider.cpp.
References setResource(), and v.
| void KoCanvasResourceProvider::setUsingOtherColor | ( | bool | usingOtherColor | ) |
setUsingOtherColor Set whether the user requested the current action to use the colors the other way around.
| usingOtherColor | whether user requested such |
Definition at line 163 of file KoCanvasResourceProvider.cpp.
References setResource(), and KoCanvasResource::UsingOtherColor.
| QSizeF KoCanvasResourceProvider::sizeResource | ( | int | key | ) | const |
Return the resource determined by param key as a QSizeF.
| key | the identifying key for the resource |
Definition at line 190 of file KoCanvasResourceProvider.cpp.
References d.
| QString KoCanvasResourceProvider::stringResource | ( | int | key | ) | const |
Return the resource determined by param key as a QString .
| key | the identifying key for the resource |
Definition at line 185 of file KoCanvasResourceProvider.cpp.
References d.
| KoUnit KoCanvasResourceProvider::unitResource | ( | int | key | ) | const |
Return the resource determined by param key as a KoUnit.
| key | the identifying key for the resource |
Definition at line 129 of file KoCanvasResourceProvider.cpp.
References resource().
|
private |
Definition at line 327 of file KoCanvasResourceProvider.h.
| QSharedPointer<CanvasResourceProviderInterfaceWrapper> KoCanvasResourceProvider::interfaceWrapper |
Definition at line 46 of file KoCanvasResourceProvider.cpp.
| KoResourceManager KoCanvasResourceProvider::manager |
Definition at line 45 of file KoCanvasResourceProvider.cpp.