QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPropertyEditor.h
Go to the documentation of this file.
1 
20 #ifndef RPROPERTYEDITOR_H
21 #define RPROPERTYEDITOR_H
22 
23 #include "core_global.h"
24 
25 #include <QCoreApplication>
26 #include <QList>
27 #include <QMap>
28 #include <QString>
29 #include <QStringList>
30 
31 #include "RDocument.h"
32 #include "RObject.h"
33 #include "RPropertyListener.h"
34 
35 
45 
46  Q_DECLARE_TR_FUNCTIONS(RPropertyEditor)
47 
48 public:
50  virtual ~RPropertyEditor();
51 
52  // from RPropertyListener interface:
53  virtual void updateFromDocument(RDocument* document, bool onlyChanges,
54  RS::EntityType entityTypeFilter = RS::EntityAll);
55  virtual void updateFromObject(RObject* object, RDocument* document = NULL);
56  virtual void clearEditor();
57  void propertyChanged(RPropertyTypeId propertyTypeId, QVariant propertyValue,
58  RS::EntityType entityTypeFilter = RS::EntityAll,
59  QVariant::Type typeHint = QVariant::Invalid);
60  void listPropertyChanged(RPropertyTypeId propertyTypeId,
61  int index, QVariant propertyValue,
62  RS::EntityType entityTypeFilter = RS::EntityAll);
63 
64  QStringList getGroupTitles();
65  QStringList getPropertyTitles(const QString& group);
66  QVariant getPropertyValue(const RPropertyTypeId& propertyTypeId);
67  QVariant getPropertyValue(const QString& group, const QString& title);
68  RPropertyAttributes getPropertyAttributes(const RPropertyTypeId& propertyTypeId);
69  RPropertyAttributes getPropertyAttributes(const QString& group, const QString& title);
70  QList<RS::EntityType> getTypes();
71  int getTypeCount(RS::EntityType type);
72 
73 protected:
74  virtual void updateEditor(RObject& object, bool doUpdateGui,
75  RDocument* document = NULL);
76 
82  virtual void updateGui(
83  bool onlyChanges = false,
84  RS::EntityType entityTypeFilter = RS::EntityAll) {
85 
86  Q_UNUSED(onlyChanges)
87  Q_UNUSED(entityTypeFilter)
88  }
89 
90  void updateProperty(const RPropertyTypeId& propertyTypeId, RObject& object,
91  RDocument* document);
92  void removeAllButThese(const QMultiMap<QString, QString>& propertyTitles, bool customOnly=false);
93 
94 protected:
96  typedef QMap<QString, QPair<QVariant, RPropertyAttributes> > RPropertyMap;
98  typedef QMap<QString, RPropertyMap> RPropertyGroupMap;
99 
100  QStringList groupOrder;
101  QMap<QString, QStringList> propertyOrder;
103  QMap<RS::EntityType, int> combinedTypes;
106 };
107 
109 
110 #endif