QCAD
Open Source 2D CAD
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, bool manual = false);
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  static bool checkType(RS::EntityType type, RS::EntityType filter);
74 
75 protected:
76  virtual void updateEditor(RObject& object, bool doUpdateGui,
77  RDocument* document = NULL);
78 
84  virtual void updateGui(
85  bool onlyChanges = false,
86  RS::EntityType entityTypeFilter = RS::EntityAll) {
87 
88  Q_UNUSED(onlyChanges)
89  Q_UNUSED(entityTypeFilter)
90  }
91 
92  void updateProperty(const RPropertyTypeId& propertyTypeId, RObject& object,
93  RDocument* document);
94  void removeAllButThese(const QMultiMap<QString, QString>& propertyTitles, bool customOnly=false);
95 
96 protected:
98  typedef QMap<QString, QPair<QVariant, RPropertyAttributes> > RPropertyMap;
100  typedef QMap<QString, RPropertyMap> RPropertyGroupMap;
101 
102  QStringList groupOrder;
103  QMap<QString, QStringList> propertyOrder;
104  RPropertyGroupMap combinedProperties;
105  QMap<RS::EntityType, int> combinedTypes;
108 };
109 
111 
112 #endif
QMap< QString, QStringList > propertyOrder
Definition: RPropertyEditor.h:103
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:75
QMap< QString, RPropertyMap > RPropertyGroupMap
group key / key,value,attributes
Definition: RPropertyEditor.h:100
Abstract base class for all objects.
Definition: RObject.h:48
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
#define QCADCORE_EXPORT
Definition: core_global.h:10
RPropertyGroupMap combinedProperties
Definition: RPropertyEditor.h:104
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyEditor.h:44
virtual void updateFromObject(RObject *object, RDocument *document=NULL)=0
This method is called if only the properties of the given property owner are currently relevant...
virtual void clearEditor()=0
This method is called to signal that no properties are currently relevant.
Abstract base class for classes that are interested in properties of the current selection or the cur...
Definition: RPropertyListener.h:43
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
Q_DECLARE_METATYPE(RMath *)
QStringList groupOrder
Definition: RPropertyEditor.h:102
All entities (for filters)
Definition: RS.h:76
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyAttributes.h:47
virtual void updateFromDocument(RDocument *document, bool onlyChanges, RS::EntityType entityTypeFilter=RS::EntityAll, bool manual=false)=0
This method is called whenever the relevant combined properties of the objects in document have chang...
QMap< QString, QPair< QVariant, RPropertyAttributes > > RPropertyMap
key / value / attributes
Definition: RPropertyEditor.h:98
bool updatesDisabled
Definition: RPropertyEditor.h:107
bool guiUpToDate
Definition: RPropertyEditor.h:106
QMap< RS::EntityType, int > combinedTypes
Definition: RPropertyEditor.h:105
virtual void updateGui(bool onlyChanges=false, RS::EntityType entityTypeFilter=RS::EntityAll)
Updates the user interface of this property editor.
Definition: RPropertyEditor.h:84