6#ifndef _KIS_PROPERTIES_CONFIGURATION_H_
7#define _KIS_PROPERTIES_CONFIGURATION_H_
20#include "kritaimage_export.h"
62 bool fromXML(
const QString& xml,
bool clear =
true)
override;
70 void fromXML(
const QDomElement&)
override;
76 void toXML(QDomDocument&, QDomElement&)
const override;
82 QString
toXML()
const override;
87 virtual bool hasProperty(
const QString& name)
const;
92 virtual void setProperty(
const QString & name,
const QVariant &
value);
101 virtual bool getProperty(
const QString & name, QVariant &
value)
const;
103 virtual QVariant getProperty(
const QString & name)
const;
105 template <
typename T>
107 QVariant
value = getProperty(name);
108 return value.isValid() ?
value.value<T>() : defaultValue;
112 return getPropertyLazy(name, QString(defaultValue));
115 int getInt(
const QString & name,
int def = 0)
const;
117 double getDouble(
const QString & name,
double def = 0.0)
const;
119 float getFloat(
const QString& name,
float def = 0.0)
const;
121 bool getBool(
const QString & name,
bool def =
false)
const;
123 QString getString(
const QString & name,
const QString & def = QString())
const;
146 virtual QMap<QString, QVariant> getProperties()
const;
149 void clearProperties();
152 void setPropertyNotSaved(
const QString & name);
154 void removeProperty(
const QString & name);
188 static QString extractedPrefixKey();
190 static QString escapeString(
const QString &
string);
191 static QString unescapeString(
const QString &
string);
204 virtual void dump()
const;
float value(const T *src, size_t ch)
QList< QString > QStringList
virtual QString toXML() const
virtual bool fromXML(const QString &, bool)
KisShared & operator=(const KisShared &)
QString getPropertyLazy(const QString &name, const char *defaultValue) const
T getPropertyLazy(const QString &name, const T &defaultValue) const