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

#include <InfoObject.h>

+ Inheritance diagram for InfoObject:

Public Slots

QVariant property (const QString &key)
 
void setProperty (const QString &key, QVariant value)
 

Public Member Functions

 InfoObject (KisPropertiesConfigurationSP configuration)
 
 InfoObject (QObject *parent=0)
 
bool operator!= (const InfoObject &other) const
 
bool operator== (const InfoObject &other) const
 
QMap< QString, QVariant > properties () const
 
void setProperties (QMap< QString, QVariant > propertyMap)
 
 ~InfoObject () override
 

Private Member Functions

KisPropertiesConfigurationSP configuration () const
 configuration gives access to the internal configuration object. Must be used internally in libkis
 

Private Attributes

Private * d
 

Friends

class Document
 
class Filter
 
class Node
 

Detailed Description

InfoObject wrap a properties map. These maps can be used to set the configuration for filters.

Definition at line 19 of file InfoObject.h.

Constructor & Destructor Documentation

◆ InfoObject() [1/2]

InfoObject::InfoObject ( KisPropertiesConfigurationSP configuration)

Definition at line 16 of file InfoObject.cpp.

17 : QObject(0)
18 , d(new Private)
19{
21}
Private * d
Definition InfoObject.h:72
KisPropertiesConfigurationSP configuration() const
configuration gives access to the internal configuration object. Must be used internally in libkis
KisPropertiesConfigurationSP properties

References configuration(), d, and krita::InfoObject::Private::properties.

◆ InfoObject() [2/2]

InfoObject::InfoObject ( QObject * parent = 0)
explicit

Create a new, empty InfoObject.

Definition at line 23 of file InfoObject.cpp.

24 : QObject(parent)
25 , d(new Private)
26{
28}

References d, and krita::InfoObject::Private::properties.

◆ ~InfoObject()

InfoObject::~InfoObject ( )
override

Definition at line 30 of file InfoObject.cpp.

31{
32 delete d;
33}

References d.

Member Function Documentation

◆ configuration()

KisPropertiesConfigurationSP InfoObject::configuration ( ) const
private

configuration gives access to the internal configuration object. Must be used internally in libkis

Returns
the internal configuration object.

Definition at line 86 of file InfoObject.cpp.

87{
88 return d->properties;
89}

References d, and krita::InfoObject::Private::properties.

◆ operator!=()

bool InfoObject::operator!= ( const InfoObject & other) const

Definition at line 40 of file InfoObject.cpp.

41{
42 return !(operator==(other));
43}
bool operator==(const InfoObject &other) const

References operator==().

◆ operator==()

bool InfoObject::operator== ( const InfoObject & other) const

Definition at line 35 of file InfoObject.cpp.

36{
37 return (d->properties == other.d->properties);
38}

References d, and krita::InfoObject::Private::properties.

◆ properties()

QMap< QString, QVariant > InfoObject::properties ( ) const

Return all properties this InfoObject manages.

Definition at line 45 of file InfoObject.cpp.

46{
47 QMap<QString, QVariant> map = d->properties->getProperties();
48
49 for (const QString &key : map.keys()) {
50 QVariant v = map.value(key);
51
52 if (v.isValid() && v.userType() == qMetaTypeId<KoColor>()) {
53 map[key] = QVariant::fromValue(v.value<KoColor>().toXML());
54 }
55 }
56
57 return map;
58}
qreal v
void toXML(QDomDocument &doc, QDomElement &colorElt) const
Definition KoColor.cpp:304

References d, krita::InfoObject::Private::properties, KoColor::toXML(), and v.

◆ property

QVariant InfoObject::property ( const QString & key)
slot

return the value for the property identified by key, or None if there is no such key.

Definition at line 72 of file InfoObject.cpp.

73{
74 QVariant v;
75 if (d->properties->hasProperty(key)) {
76 d->properties->getProperty(key, v);
77
78 if (v.isValid() && v.userType() == qMetaTypeId<KoColor>()) {
79 return QVariant::fromValue(v.value<KoColor>().toXML());
80 }
81 }
82
83 return v;
84}

References d, krita::InfoObject::Private::properties, KoColor::toXML(), and v.

◆ setProperties()

void InfoObject::setProperties ( QMap< QString, QVariant > propertyMap)

Add all properties in the propertyMap to this InfoObject

Definition at line 60 of file InfoObject.cpp.

61{
62 Q_FOREACH(const QString & key, propertyMap.keys()) {
63 d->properties->setProperty(key, propertyMap[key]);
64 }
65}

References d, and krita::InfoObject::Private::properties.

◆ setProperty

void InfoObject::setProperty ( const QString & key,
QVariant value )
slot

set the property identified by key to value

If you want create a property that represents a color, you can use a QColor or hex string, as defined in https://doc.qt.io/qt-6/qcolor.html#fromString.

Definition at line 67 of file InfoObject.cpp.

68{
69 d->properties->setProperty(key, value);
70}
float value(const T *src, size_t ch)

References d, krita::InfoObject::Private::properties, and value().

Friends And Related Symbol Documentation

◆ Document

friend class Document
friend

Definition at line 62 of file InfoObject.h.

◆ Filter

friend class Filter
friend

Definition at line 61 of file InfoObject.h.

◆ Node

friend class Node
friend

Definition at line 63 of file InfoObject.h.

Member Data Documentation

◆ d

Private* InfoObject::d
private

Definition at line 72 of file InfoObject.h.


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