QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
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 <QList>
26#include <QMap>
27#include <QString>
28#include <QStringList>
29#if QT_VERSION >= 0x060000
30#include <QPromise>
31#endif
32
33#include "RLayerListener.h"
34#include "RPropertyListener.h"
35
36class RDocument;
38class RLayerListener;
39class RObject;
40class RProperty;
42class RPropertyEditor;
44class RPropertyTypeId;
45
46
47
48
58
59#if QT_VERSION >= 0x060000
60 public QObject,
61#endif
62 public RPropertyListener, public RLayerListener {
63
64#if QT_VERSION >= 0x060000
65 Q_OBJECT
66#endif
67
68public:
70 virtual ~RPropertyEditor();
71
72 static RPropertyEditor* getInstance();
73
74 // from RPropertyListener interface:
75 virtual void updateFromDocument(RDocument* document, bool onlyChanges, RS::EntityType filter = RS::EntityUnknown, bool manual = false, bool showOnRequest = false);
76
77#if QT_VERSION >= 0x060000
81 void sleep(QPromise<void>& promise, RDocument* document, bool onlyChanges, RS::EntityType filter, bool manual, bool showOnRequest);
82
83signals:
84 void finished(RDocument* document, bool onlyChanges, RS::EntityType filter, bool manual, bool showOnRequest);
85#endif
86
87#if QT_VERSION >= 0x060000
88public slots:
89#else
90public:
91#endif
92 void updateFromDocumentNow(RDocument* document, bool onlyChanges, RS::EntityType filter = RS::EntityUnknown, bool manual = false, bool showOnRequest = false);
93
94public:
95 virtual void updateFromObject(RObject* object, RDocument* document = NULL);
96 virtual void clearEditor();
97
98 virtual QStringList getFixedCustomPropertyNames(const QList<RS::EntityType>& objectTypes) {
99 return QStringList();
100 }
101
102 virtual void updateLayers(RDocumentInterface* documentInterface, QList<RObject::Id>& layerIds);
103 virtual void updateLayers(RDocumentInterface* documentInterface);
104 virtual void setCurrentLayer(RDocumentInterface* documentInterface, RObject::Id previousLayerId);
105 virtual void clearLayers();
106
107 void propertyChanged(RPropertyTypeId propertyTypeId, QVariant propertyValue,
108 RS::MetaType typeHint = RS::UnknownType);
109 void listPropertyChanged(RPropertyTypeId propertyTypeId,
110 int index, QVariant propertyValue);
111
112 QStringList getGroupTitles();
113 QStringList getPropertyTitles(const QString& group);
114 QVariant getPropertyValue(const RPropertyTypeId& propertyTypeId);
115 QVariant getPropertyValue(const QString& group, const QString& title);
116 RPropertyAttributes getPropertyAttributes(const RPropertyTypeId& propertyTypeId);
117 RPropertyAttributes getPropertyAttributes(const QString& group, const QString& title);
118 RPropertyAttributes getCustomPropertyAttributes(const QString& group, const QString& title);
119 QList<RS::EntityType> getTypes();
120 int getTypeCount(RS::EntityType type);
121
123 entityTypeFilter = type;
124 }
125
127 return entityTypeFilter;
128 }
129
130 virtual QStringList getAppProperties() { return QStringList(); }
131
132 static bool checkType(RS::EntityType type, RS::EntityType filter);
133
134 static void makeReadOnly(QWidget* control, bool on);
135
136protected:
140 virtual void updateEditor(RObject& object, const QList<RPropertyTypeId>& propertyTypeIds, bool doUpdateGui, RDocument* document = NULL, bool showOnRequest = false);
141
147 virtual void updateGui(bool onlyChanges = false) {
148 Q_UNUSED(onlyChanges)
149 }
150
151 void updateProperty(const RPropertyTypeId& propertyTypeId, RObject& object, RDocument* document, bool showOnRequest = false);
152
153 virtual bool showCustomAppProperties(RPropertyAttributes::Option opt);
154
155 static void computePropertyValue(RProperty& property);
156
157protected:
162
163 QStringList groupOrder;
169
171
173
174
175private:
177};
178
180
181#endif
Q_DECLARE_METATYPE(RMath *)
Definition RDebug.h:38
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Interface for interaction between a graphics document and a user.
Definition RDocumentInterface.h:97
Abstract base class for classes that are interested in being notified whenever a layer has been added...
Definition RLayerListener.h:39
virtual void updateLayers(RDocumentInterface *documentInterface, QList< RObject::Id > &layerIds)=0
This method is called whenever at least one layer in the given document has changed.
virtual void clearLayers()=0
This method is called to signal that no document is currently active.
Abstract base class for all objects.
Definition RObject.h:64
int Id
Definition RObject.h:69
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyAttributes.h:42
Option
Definition RPropertyAttributes.h:44
Base class for property editors.
Definition RPropertyEditor.h:62
QMap< RS::EntityType, int > combinedTypes
Definition RPropertyEditor.h:166
bool guiUpToDate
Definition RPropertyEditor.h:167
virtual QStringList getAppProperties()
Definition RPropertyEditor.h:130
bool terminate
Definition RPropertyEditor.h:176
RS::EntityType getEntityTypeFilter() const
Definition RPropertyEditor.h:126
QMap< QString, QStringList > propertyOrder
Definition RPropertyEditor.h:164
QMap< QString, RPropertyMap > RPropertyGroupMap
group key / key,value,attributes
Definition RPropertyEditor.h:161
RS::EntityType entityTypeFilter
Definition RPropertyEditor.h:170
static RPropertyEditor * instance
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyEditor.h:172
bool updatesDisabled
Definition RPropertyEditor.h:168
RPropertyGroupMap combinedProperties
Definition RPropertyEditor.h:165
void setEntityTypeFilter(RS::EntityType type)
Definition RPropertyEditor.h:122
virtual QStringList getFixedCustomPropertyNames(const QList< RS::EntityType > &objectTypes)
Definition RPropertyEditor.h:98
virtual void updateGui(bool onlyChanges=false)
Updates the user interface of this property editor.
Definition RPropertyEditor.h:147
QMap< QString, QPair< QVariant, RPropertyAttributes > > RPropertyMap
key / value / attributes
Definition RPropertyEditor.h:159
QStringList groupOrder
Definition RPropertyEditor.h:163
Property with type ID, value and attributes.
Definition RProperty.h:16
Abstract base class for classes that are interested in properties of the current selection or the cur...
Definition RPropertyListener.h:43
virtual void clearEditor()=0
This method is called to signal that no properties are currently relevant.
virtual void updateFromDocument(RDocument *document, bool onlyChanges, RS::EntityType entityTypeFilter=RS::EntityAll, bool manual=false, bool showOnRequest=false)=0
This method is called whenever the relevant combined properties of the objects in document have chang...
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.
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyTypeId.h:54
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ EntityUnknown
Unknown entity.
Definition RS.h:242
MetaType
Definition RS.h:156
@ UnknownType
Definition RS.h:161
#define QCADCORE_EXPORT
Definition core_global.h:10
void setCurrentLayer(void layerName)
Sets the current layer to the given layer.
Definition simple_create.js:127
void sleep(void d)
Sleeps for the indicated time in milliseconds.
Definition simple.js:44
#define NULL
Definition opennurbs_system.h:256