#ifndef VARIANTMANAGER_H
#define VARIANTMANAGER_H
#include "Common.h"
#include "qtvariantproperty.h"
#include "qttreepropertybrowser.h"
///
/// 扩展VariantManager类,增加自定义的属性处理
///
class VariantManager : public QtVariantPropertyManager
{
Q_OBJECT
public:
explicit VariantManager(QObject *parent = Q_NULLPTR);
~VariantManager();
virtual QVariant value(const QtProperty *property) const;
virtual int valueType(int propertyType) const;
virtual bool isPropertyTypeSupported(int propertyType) const;
virtual QStringList attributes(int propertyType) const;
virtual int attributeType(int propertyType, const QString &attribute) const;
virtual QVariant attributeValue(const QtProperty *property, const QString &attribute) const;
static int tagDataLinkTypeId();
static int tagTableExInfoTypeId();
void setPropertyEditor(QtTreePropertyBrowser *editor);
QtTreePropertyBrowser *getPropertyEditor();
public slots:
virtual void setValue(QtProperty *property, const QVariant &val);
virtual void setAttribute(QtProperty *property,
const QString &attribute, const QVariant &value);
protected:
virtual QString valueText(const QtProperty *property) const;
virtual void initializeProperty(QtProperty *property);
virtual void uninitializeProperty(QtProperty *property);
private:
QtTreePropertyBrowser *propertyEditor_ = Q_NULLPTR;
private:
struct Data {
QString value;
QString attribute;
};
QMap theValues;
};
#endif