20#include "kexicustompropertyfactory.h"
21#include "kexicustompropertyfactory_p.h"
22#include <kexiutils/identifier.h>
24#include <koproperty/customproperty.h>
26using namespace KoProperty;
29class PixmapIdCustomProperty :
public CustomProperty
32 PixmapIdCustomProperty(Property *parent)
33 : CustomProperty(parent) {
35 virtual ~PixmapIdCustomProperty() {};
36 virtual void setValue(
const TQVariant &value,
bool rememberOldValue) {
38 Q_UNUSED( rememberOldValue);
40 virtual TQVariant value()
const {
return m_property->value(); }
41 virtual bool handleValue()
const {
47class IdentifierCustomProperty :
public CustomProperty
50 IdentifierCustomProperty(Property *parent)
51 : CustomProperty(parent) {
53 virtual ~IdentifierCustomProperty() {};
54 virtual void setValue(
const TQVariant &value,
bool rememberOldValue)
56 Q_UNUSED(rememberOldValue);
57 if (!value.toString().isEmpty())
60 virtual TQVariant value()
const {
return m_value; }
61 virtual bool handleValue()
const {
69KexiCustomPropertyFactory::KexiCustomPropertyFactory(TQObject* parent)
70: CustomPropertyFactory(parent)
74KexiCustomPropertyFactory::~KexiCustomPropertyFactory()
78CustomProperty* KexiCustomPropertyFactory::createCustomProperty(Property *parent)
80 const int type = parent->type();
82 return new PixmapIdCustomProperty(parent);
84 return new IdentifierCustomProperty(parent);
88Widget* KexiCustomPropertyFactory::createCustomWidget(Property *prop)
90 const int type = prop->type();
92 return new KexiImagePropertyEdit(prop);
94 return new KexiIdentifierPropertyEdit(prop);
106 TQValueList<int> types;
108 KoProperty::FactoryManager::self()->registerFactoryForProperties(types, factory);
109 KoProperty::FactoryManager::self()->registerFactoryForEditors(types, factory);
Kexi-specific custom property factory for KoProperty library.
@ PixmapId
Shared Kexi pixmap.
@ Identifier
string allowing nonempty identifiers
static void init()
Called once to register all propert and editor types provided by this factory.
KEXIUTILS_EXPORT TQString string2Identifier(const TQString &s)