variantfactory.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 
  2. #ifndef VARIANTFACTORY_H
  3. #define VARIANTFACTORY_H
  4. #include "qtvariantproperty.h"
  5. class FunctionEdit;
  6. class VariantFactory : public QtVariantEditorFactory
  7. {
  8. Q_OBJECT
  9. public:
  10. VariantFactory(QObject *parent = Q_NULLPTR) : QtVariantEditorFactory(parent) { }
  11. virtual ~VariantFactory();
  12. protected:
  13. // 关联属性管理器
  14. virtual void connectPropertyManager(QtVariantPropertyManager *manager);
  15. // 通过实现 createEditor 虚函数来为每种不同的类型增加对话框
  16. virtual QWidget *createEditor(QtVariantPropertyManager *manager,
  17. QtProperty *property,
  18. QWidget *parent);
  19. virtual void disconnectPropertyManager(QtVariantPropertyManager *manager);
  20. private slots:
  21. void slotPropertyChanged(QtProperty *property, const QVariant &value);
  22. void slotPropertyAttributeChanged(QtProperty *property,
  23. const QString &attribute,
  24. const QVariant &value);
  25. void slotSetValue(const QString &value);
  26. void slotEditorDestroyed(QObject *object);
  27. private:
  28. QMap<QtProperty *, QList<QWidget *> > theCreatedEditors;
  29. QMap<QWidget *, QtProperty *> theEditorToProperty;
  30. };
  31. #endif