QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPropertyEditor.h
Go to the documentation of this file.
1 #ifndef RPROPERTYEDITOR_H
2 #define RPROPERTYEDITOR_H
3 
4 #include <QCoreApplication>
5 #include <QList>
6 #include <QMap>
7 #include <QString>
8 #include <QStringList>
9 
10 #include "RDocument.h"
11 #include "RObject.h"
12 #include "RPropertyListener.h"
13 
14 
24 
25  Q_DECLARE_TR_FUNCTIONS(RPropertyEditor)
26 
27 public:
29  virtual ~RPropertyEditor();
30 
31  // from RPropertyListener interface:
32  virtual void updateFromDocument(RDocument* document, bool onlyChanges,
33  RS::EntityType entityTypeFilter = RS::EntityAll);
34  virtual void updateFromObject(RObject* object, RDocument* document = NULL);
35  virtual void clearEditor();
36  void propertyChanged(RPropertyTypeId propertyTypeId, QVariant propertyValue,
37  RS::EntityType entityTypeFilter = RS::EntityAll,
38  QVariant::Type typeHint = QVariant::Invalid);
39  void listPropertyChanged(RPropertyTypeId propertyTypeId,
40  int index, QVariant propertyValue,
41  RS::EntityType entityTypeFilter = RS::EntityAll);
42 
43  QStringList getGroupTitles();
44  QStringList getPropertyTitles(const QString& group);
45  QVariant getPropertyValue(const RPropertyTypeId& propertyTypeId);
46  QVariant getPropertyValue(const QString& group, const QString& title);
48  RPropertyAttributes getPropertyAttributes(const QString& group, const QString& title);
49  QList<RS::EntityType> getTypes();
50  int getTypeCount(RS::EntityType type);
51 
52 protected:
53  virtual void updateEditor(RObject& object, bool doUpdateGui,
54  RDocument* document = NULL);
55 
61  virtual void updateGui(
62  bool onlyChanges = false,
63  RS::EntityType entityTypeFilter = RS::EntityAll) {
64 
65  Q_UNUSED(onlyChanges)
66  Q_UNUSED(entityTypeFilter)
67  }
68 
69  void updateProperty(const RPropertyTypeId& propertyTypeId, RObject& object,
70  RDocument* document);
71  void removeAllButThese(const QMultiMap<QString, QString>& propertyTitles);
72  //void updateEditor(RObject::Id objectId, bool doUpdateGui = true,
73  // RDocument* document = NULL);
74 
75 protected:
77  typedef QMap<QString, QPair<QVariant, RPropertyAttributes> > RPropertyMap;
79  typedef QMap<QString, RPropertyMap> RPropertyGroupMap;
80 
81  QStringList groupOrder;
82  QMap<QString, QStringList> propertyOrder;
84  QMap<RS::EntityType, int> combinedTypes;
87 };
88 
90 
91 #endif