20#ifndef KPROPERTY_FACTORY_H
21#define KPROPERTY_FACTORY_H
32class KPROPERTYCORE_EXPORT KComposedPropertyInterface
35 explicit KComposedPropertyInterface(
KProperty *parent);
36 virtual ~KComposedPropertyInterface();
49 void childValueChangedInternal(
KProperty *child,
const QVariant &value, KProperty::ValueOptions valueOptions);
51 bool childValueChangedEnabled()
const;
53 void setChildValueChangedEnabled(
bool set);
61 virtual void childValueChanged(
KProperty *child,
const QVariant &value, KProperty::ValueOptions valueOptions) = 0;
68 Q_DISABLE_COPY(KComposedPropertyInterface)
73class KPROPERTYCORE_EXPORT KComposedPropertyCreatorInterface
76 KComposedPropertyCreatorInterface();
78 virtual ~KComposedPropertyCreatorInterface();
83 Q_DISABLE_COPY(KComposedPropertyCreatorInterface)
89template<
class ComposedProperty>
90class KComposedPropertyCreator :
public KComposedPropertyCreatorInterface
93 KComposedPropertyCreator() : KComposedPropertyCreatorInterface() {}
95 ~KComposedPropertyCreator()
override {}
97 ComposedProperty* createComposedProperty(
KProperty *parent)
const override {
98 return new ComposedProperty(parent);
101 Q_DISABLE_COPY(KComposedPropertyCreator)
105class KPROPERTYCORE_EXPORT KPropertyValueDisplayInterface
108 KPropertyValueDisplayInterface();
110 virtual ~KPropertyValueDisplayInterface();
113 {
return valueToString(property->
value(), locale); }
128 Q_DISABLE_COPY(KPropertyValueDisplayInterface)
133class KPROPERTYCORE_EXPORT KPropertyFactory
138 virtual ~KPropertyFactory();
143 void addComposedPropertyCreator(
int type, KComposedPropertyCreatorInterface* creator);
148 void addComposedPropertyCreatorInternal(
int type,
149 KComposedPropertyCreatorInterface* creator,
bool own =
true);
155 Q_DISABLE_COPY(KPropertyFactory)
160class KPROPERTYCORE_EXPORT KPropertyFactoryManager :
public QObject
164 KComposedPropertyInterface* createComposedProperty(KProperty *parent);
167 void registerFactory(KPropertyFactory *factory);
170 static KPropertyFactoryManager* self();
172 bool canConvertValueToText(
int type)
const;
174 bool canConvertValueToText(
const KProperty* property)
const;
176 QString propertyValueToString(
const KProperty* property)
const;
178 QString valueToString(
int type,
const QVariant &value)
const;
180 QString propertyValueToLocalizedString(
const KProperty* property)
const;
182 QString valueToLocalizedString(
int type,
const QVariant &value)
const;
184 KPropertyFactoryManager();
185 ~KPropertyFactoryManager()
override;
189 static void addInitFunction(
void (*initFunction)());
192 Q_DISABLE_COPY(KPropertyFactoryManager)
An interface for for composed property handlers.
virtual bool valuesEqual(const QVariant &first, const QVariant &second)
void emitPropertyChanged()
virtual void setValue(KProperty *property, const QVariant &value, KProperty::ValueOptions valueOptions)=0
Provides a specialized conversion of value to string depending on type.
static QString valueToLocalizedString(const QVariant &value)
static int maxStringValueLength()
Maximum length of strings to display in valueToString(), propertyValueToString() and KPropertyValuePa...
The base class representing a single property.