Krita Source Code Documentation
Loading...
Searching...
No Matches
KisBaseNode::Property Struct Reference

#include <kis_base_node.h>

Public Member Functions

bool operator== (const Property &rhs) const
 
 Property ()
 
 Property (const KoID &n, const QIcon &on, const QIcon &off, bool isOn)
 Constructor for a mutable property.
 
 Property (const KoID &n, const QIcon &on, const QIcon &off, bool isOn, bool _isInStasis, bool _stateInStasis=false)
 
 Property (const KoID &n, const QString &s)
 Constructor for a nonmutable property.
 

Public Attributes

bool canHaveStasis {false}
 
QString id
 
bool isInStasis {false}
 
bool isMutable {false}
 
QString name
 
QIcon offIcon
 
QIcon onIcon
 
QVariant state
 
bool stateInStasis {false}
 

Detailed Description

Describes a property of a document section.

FIXME: using a QList instead of QMap and not having an untranslated identifier, either enum or string, forces applications to rely on the order of properties or to compare the translated strings. This makes it hard to robustly extend the properties of document section items.

Definition at line 51 of file kis_base_node.h.

Constructor & Destructor Documentation

◆ Property() [1/4]

KisBaseNode::Property::Property ( )
inline

Definition at line 84 of file kis_base_node.h.

84: isMutable( false ), isInStasis(false) { }

◆ Property() [2/4]

KisBaseNode::Property::Property ( const KoID & n,
const QIcon & on,
const QIcon & off,
bool isOn )
inline

Constructor for a mutable property.

Definition at line 87 of file kis_base_node.h.

88 : id(n.id()), name( n.name() ), isMutable( true ), onIcon( on ), offIcon( off ), state( isOn ),
89 canHaveStasis( false ), isInStasis(false) { }
QString name() const
Definition KoID.cpp:68
QString id() const
Definition KoID.cpp:63

◆ Property() [3/4]

KisBaseNode::Property::Property ( const KoID & n,
const QIcon & on,
const QIcon & off,
bool isOn,
bool _isInStasis,
bool _stateInStasis = false )
inline

Constructor for a mutable property accepting stasis

Definition at line 92 of file kis_base_node.h.

94 : id(n.id()), name(n.name()), isMutable( true ), onIcon( on ), offIcon( off ), state( isOn ),
95 canHaveStasis( true ), isInStasis( _isInStasis ), stateInStasis( _stateInStasis ) { }

◆ Property() [4/4]

KisBaseNode::Property::Property ( const KoID & n,
const QString & s )
inline

Constructor for a nonmutable property.

Definition at line 98 of file kis_base_node.h.

99 : id(n.id()), name(n.name()), isMutable( false ), state( s ), isInStasis(false) { }

Member Function Documentation

◆ operator==()

bool KisBaseNode::Property::operator== ( const Property & rhs) const
inline

Definition at line 80 of file kis_base_node.h.

80 {
81 return rhs.name == name && rhs.state == state && isInStasis == rhs.isInStasis;
82 }

References isInStasis, name, and state.

Member Data Documentation

◆ canHaveStasis

bool KisBaseNode::Property::canHaveStasis {false}

If the property is mutable, specifies whether it can be put into stasis. When a property is in stasis, a new state is created, and the old one is stored in stateInStasis. When stasis ends, the old value is restored and the new one discarded

Definition at line 71 of file kis_base_node.h.

71{false};

◆ id

QString KisBaseNode::Property::id

Definition at line 53 of file kis_base_node.h.

◆ isInStasis

bool KisBaseNode::Property::isInStasis {false}

If the property isMutable and canHaveStasis, indicate whether it is in stasis or not

Definition at line 74 of file kis_base_node.h.

74{false};

◆ isMutable

bool KisBaseNode::Property::isMutable {false}

Whether the property is a boolean (e.g. locked, visible) which can be toggled directly from the widget itself.

Definition at line 59 of file kis_base_node.h.

59{false};

◆ name

QString KisBaseNode::Property::name

i18n-ed name, suitable for displaying

Definition at line 56 of file kis_base_node.h.

◆ offIcon

QIcon KisBaseNode::Property::offIcon

Definition at line 63 of file kis_base_node.h.

◆ onIcon

QIcon KisBaseNode::Property::onIcon

Provide these if the property isMutable.

Definition at line 62 of file kis_base_node.h.

◆ state

QVariant KisBaseNode::Property::state

If the property isMutable, provide a boolean. Otherwise, a string suitable for displaying.

Definition at line 66 of file kis_base_node.h.

◆ stateInStasis

bool KisBaseNode::Property::stateInStasis {false}

If the property isMutable and canHaveStasis, provide this value to store the property's state while in stasis

Definition at line 78 of file kis_base_node.h.

78{false};

The documentation for this struct was generated from the following file: