RObject
Class in Core Module
Header: #include <src/core/RObject.h>
Inherited by: RBlock, RDimStyle, RDocumentVariables, REntity, RLayer, RLayerState, RLayout, RLinetype, RUcs, RView
Description
Section titled “Description”Abstract base class for all objects.
Objects have an unique ID. Object types may register property types. Objects manage their own set of properties. Example objects are entities, layers, user coordinate systems.
See also: RPropertyTypeId
Scriptable: This class is available in script environments.
Shared Pointer Support: Objects can be used in QSharedPointer.
Public Types
Section titled “Public Types”| typedef | int Handle |
| typedef | int Id |
| enum | ObjectFlag { NoFlags, Undone, Protect, Selected, Invisible, WorkingSet } |
| enum | XYZ { X, Y, Z } |
Public Functions
Section titled “Public Functions”RObject(const RObject &other) |
|
RObject(RDocument *document=NULL) |
|
| virtual | ~RObject() |
| virtual QSharedPointer< RObject > | clone() const =0 = 0 |
| void | copyCustomPropertiesFrom(const RObject *other, const QString &title=RDEFAULT_QSTRING, bool overwrite=false, const QStringList &ignoreList=RDEFAULT_QSTRINGLIST, const QString &mapKeyFrom=RDEFAULT_QSTRING, const QString &mapKeyTo=RDEFAULT_QSTRING)Copies all custom properties from the given object. |
| void | dump() const |
| virtual void | forceAutoUpdate() |
| virtual int | getComplexity() const |
| virtual bool | getCustomBoolProperty(const QString &title, const QString &key, bool defaultValue) const |
| virtual double | getCustomDoubleProperty(const QString &title, const QString &key, double defaultValue) const |
| virtual int | getCustomIntProperty(const QString &title, const QString &key, int defaultValue) const |
| QMap< QString, QVariantMap > | getCustomProperties() const |
| virtual QVariant | getCustomProperty(const QString &title, const QString &key, const QVariant &defaultValue=RDEFAULT_QVARIANT) const |
| QStringList | getCustomPropertyKeys(const QString &title) const |
| QStringList | getCustomPropertyTitles() const |
| virtual QSet< RPropertyTypeId > | getCustomPropertyTypeIds() const |
| RDocument * | getDocument() |
| const RDocument * | getDocument() const |
| bool | getFlag(int flag) const |
| RObject::Handle | getHandle() const |
| RObject::Id | getId() const |
| virtual QPair< QVariant, RPropertyAttributes > | getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false) |
| virtual QSet< RPropertyTypeId > | getPropertyTypeIds(RPropertyAttributes::Option option=RPropertyAttributes::NoOptions) const |
| virtual RS::EntityType | getType() const |
| bool | hasCustomProperties() const |
| bool | hasCustomProperty(const QString &title, const QRegularExpression &key) const |
| bool | hasCustomProperty(const QString &title, const QString &key) const |
| virtual bool | hasPropertyType(RPropertyTypeId propertyTypeId) |
| bool | isInvisible() const |
| virtual bool | isOfType(RS::EntityType t) constOverride to indicate that this entity is of a certain type, e.g. |
| bool | isProtected() const |
| virtual bool | isSelected() const |
| bool | isUndone() const |
| virtual bool | isWorkingSet() const |
| virtual bool | mustAlwaysClone() const |
| virtual void | removeCustomProperty(const QString &title, const QString &key)Removes the custom property with the given name. |
| virtual void | setAutoUpdatesBlocked(bool on) |
| virtual void | setCustomProperties(const RQMapQStringQString &properties) |
| virtual void | setCustomProperty(const QString &title, const QString &key, const QVariant &value)Sets a custom property with the given name. |
| void | setDocument(RDocument *document) |
| void | setFlag(int flag, bool on=true) |
| void | setInvisible(bool on) |
| virtual bool | setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)Sets the given property to the given value. |
| void | setProtected(bool on) |
| virtual void | setSelected(bool on) |
| virtual void | setWorkingSet(bool on) |
| virtual bool | validate() |
Static Public Functions
Section titled “Static Public Functions”| static RPropertyAttributes | getCustomPropertyAttributes(const QString &title, const QString &key) |
| static RS::EntityType | getRtti() |
| static void | init() |
| static void | setCustomPropertyAttributes(const QString &title, const QString &key, const RPropertyAttributes &att)Set attributes (read-only, invisible, …) for the given custom property. |
| static bool | setMember(T &variable, const QVariant &value, bool condition=true) |
Static Public Attributes
Section titled “Static Public Attributes”| static const Handle | INVALID_HANDLE |
| static const Id | INVALID_ID |
| static RPropertyTypeId | PropertyCustom |
| static RPropertyTypeId | PropertyHandle |
| static RPropertyTypeId | PropertyInvisible |
| static RPropertyTypeId | PropertyProtected |
| static RPropertyTypeId | PropertySelected |
| static RPropertyTypeId | PropertyType |
| static RPropertyTypeId | PropertyWorkingSet |
| static const Handle | UNKNOWN_HANDLE |
Protected Functions
Section titled “Protected Functions”| virtual void | print(QDebug dbg) constStream operator for QDebug. |
| void | setHandle(RObject::Handle h) |
| void | setId(RObject::Id id) |
| bool | setMemberFlag(int flag, const QVariant &value, bool condition=true)This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
| void | setUndone(bool on) |
Static Protected Functions
Section titled “Static Protected Functions”| static bool | setMember(bool &variable, const QVariant &value, bool condition=true)This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
| static bool | setMember(double &variable, const QVariant &value, bool condition=true)This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
| static bool | setMember(int &variable, const QVariant &value, bool condition=true)This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
| static bool | setMember(QList< double > &variable, const QVariant &value, bool condition) |
| static bool | setMember(QList< int > &variable, const QVariant &value, bool condition) |
| static bool | setMember(QString &variable, const QVariant &value, bool condition=true)Sets the given property. |
| static bool | setMemberVector(QList< RVector > &variable, const QVariant &value, RObject::XYZ xyz) |
| static bool | setMemberX(QList< RVector > &variable, const QVariant &value, bool condition=true) |
| static bool | setMemberY(QList< RVector > &variable, const QVariant &value, bool condition=true) |
| static bool | setMemberZ(QList< RVector > &variable, const QVariant &value, bool condition=true) |
Private Attributes
Section titled “Private Attributes”| QMap< QString, QVariantMap > | customProperties AppID -> key -> value e.g. |
| RDocument * | document |
| Flags | flags Object flags (undone, protected, …). |
| Handle | handle Handle of this object (from DXF / DWG). |
| Id | objectId Unique ID of this object. |
Static Private Attributes
Section titled “Static Private Attributes”| static QMap< QString, QMap< QString, RPropertyAttributes > > | customPropertyAttributes Attributes of custom properties (read-only, invisible, …). |
Friends
Section titled “Friends”| QDebug | operator<<(QDebug dbg, const RObject &o) |
| class | RStorage |
Member Documentation
Section titled “Member Documentation”Handle
Section titled “Handle”typedef int RObject::Handletypedef int RObject::IdObjectFlag
Section titled “ObjectFlag”enum ObjectFlagenum XYZ| Value | Description |
|---|---|
X |
|
Y |
|
Z |
RObject
Section titled “RObject”RObject::RObject(const RObject &other)RObject
Section titled “RObject”RObject::RObject(RDocument *document=NULL)~RObject
Section titled “~RObject”virtual RObject::~RObject()virtual
virtual QSharedPointer< RObject > RObject::clone() const =0 = 0pure virtual const
Reimplemented in clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone, clone.
copyCustomPropertiesFrom
Section titled “copyCustomPropertiesFrom”void RObject::copyCustomPropertiesFrom(const RObject *other, const QString &title=RDEFAULT_QSTRING, bool overwrite=false, const QStringList &ignoreList=RDEFAULT_QSTRINGLIST, const QString &mapKeyFrom=RDEFAULT_QSTRING, const QString &mapKeyTo=RDEFAULT_QSTRING)Copies all custom properties from the given object.
Existing properties can be overwritten.
void RObject::dump() constinline const
forceAutoUpdate
Section titled “forceAutoUpdate”virtual void RObject::forceAutoUpdate()virtual inline
Reimplemented in forceAutoUpdate.
getComplexity
Section titled “getComplexity”virtual int RObject::getComplexity() constvirtual inline const
Reimplemented in getComplexity, getComplexity, getComplexity, getComplexity.
getCustomBoolProperty
Section titled “getCustomBoolProperty”virtual bool RObject::getCustomBoolProperty(const QString &title, const QString &key, bool defaultValue) constvirtual const
getCustomDoubleProperty
Section titled “getCustomDoubleProperty”virtual double RObject::getCustomDoubleProperty(const QString &title, const QString &key, double defaultValue) constvirtual const
getCustomIntProperty
Section titled “getCustomIntProperty”virtual int RObject::getCustomIntProperty(const QString &title, const QString &key, int defaultValue) constvirtual const
getCustomProperties
Section titled “getCustomProperties”QMap< QString, QVariantMap > RObject::getCustomProperties() constconst
Non-Scriptable: This function is not available in script environments.
Returns: Map of custom properties assigned to this object.
getCustomProperty
Section titled “getCustomProperty”virtual QVariant RObject::getCustomProperty(const QString &title, const QString &key, const QVariant &defaultValue=RDEFAULT_QVARIANT) constvirtual const
Returns: Value of given custom property or the given default value if no such property exists.
getCustomPropertyKeys
Section titled “getCustomPropertyKeys”QStringList RObject::getCustomPropertyKeys(const QString &title) constconst
Returns: List of custom property keys for the given title (application).
getCustomPropertyTitles
Section titled “getCustomPropertyTitles”QStringList RObject::getCustomPropertyTitles() constconst
Returns: List of custom property titles. These are typically names of applications which have assigned custom properties to this object.
getCustomPropertyTypeIds
Section titled “getCustomPropertyTypeIds”virtual QSet< RPropertyTypeId > RObject::getCustomPropertyTypeIds() constvirtual const
Returns: A set of all custom property IDs of properties that are available for this object.
Reimplemented in getCustomPropertyTypeIds.
getDocument
Section titled “getDocument”RDocument * RObject::getDocument()inline
getDocument
Section titled “getDocument”const RDocument * RObject::getDocument() constinline const
getFlag
Section titled “getFlag”bool RObject::getFlag(int flag) constinline const
getHandle
Section titled “getHandle”RObject::Handle RObject::getHandle() constinline const
RObject::Id RObject::getId() constinline const
Returns: The ID of the object or -1 if the object has no ID. An object without ID is not stored in the DB and not part of a document.
getProperty
Section titled “getProperty”virtual QPair< QVariant, RPropertyAttributes > RObject::getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)virtual
Returns: The value and attributes of the given property or an invalid property if this property owner has no property with the given ID.
Reimplemented in getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty.
getPropertyTypeIds
Section titled “getPropertyTypeIds”virtual QSet< RPropertyTypeId > RObject::getPropertyTypeIds(RPropertyAttributes::Option option=RPropertyAttributes::NoOptions) constvirtual const
Returns: A set of all property IDs of properties that are available for this object. The IDs that are returned can be translated into a group title and a property title using getPropertyGroupTitle and getPropertyTitle.
Reimplemented in getPropertyTypeIds.
getType
Section titled “getType”virtual RS::EntityType RObject::getType() constvirtual inline const
Returns: The unique entity type, usually the same as RTTI, different for custom entities.
Reimplemented in getType, getType, getType, getType, getType, getType, getType, getType, getType, getType.
hasCustomProperties
Section titled “hasCustomProperties”bool RObject::hasCustomProperties() constconst
hasCustomProperty
Section titled “hasCustomProperty”bool RObject::hasCustomProperty(const QString &title, const QRegularExpression &key) constconst
Non-Scriptable: This function is not available in script environments.
hasCustomProperty
Section titled “hasCustomProperty”bool RObject::hasCustomProperty(const QString &title, const QString &key) constconst
hasPropertyType
Section titled “hasPropertyType”virtual bool RObject::hasPropertyType(RPropertyTypeId propertyTypeId)virtual inline
Returns: True if this property owner has a property with the given ID, false otherwise.
isInvisible
Section titled “isInvisible”bool RObject::isInvisible() constinline const
isOfType
Section titled “isOfType”virtual bool RObject::isOfType(RS::EntityType t) constvirtual inline const
Override to indicate that this entity is of a certain type, e.g.
a block reference even if type ID is different.
isProtected
Section titled “isProtected”bool RObject::isProtected() constinline const
isSelected
Section titled “isSelected”virtual bool RObject::isSelected() constvirtual inline const
Reimplemented in isSelected.
isUndone
Section titled “isUndone”bool RObject::isUndone() constinline const
isWorkingSet
Section titled “isWorkingSet”virtual bool RObject::isWorkingSet() constvirtual inline const
mustAlwaysClone
Section titled “mustAlwaysClone”virtual bool RObject::mustAlwaysClone() constvirtual inline const
Returns: True to always clone object instead of saving diff when object changes. This can be used for complex object types which cannot be modified using properties.
Reimplemented in mustAlwaysClone.
removeCustomProperty
Section titled “removeCustomProperty”virtual void RObject::removeCustomProperty(const QString &title, const QString &key)virtual
Removes the custom property with the given name.
setAutoUpdatesBlocked
Section titled “setAutoUpdatesBlocked”virtual void RObject::setAutoUpdatesBlocked(bool on)virtual inline
Reimplemented in setAutoUpdatesBlocked.
setCustomProperties
Section titled “setCustomProperties”virtual void RObject::setCustomProperties(const RQMapQStringQString &properties)virtual
Non-Scriptable: This function is not available in script environments.
setCustomProperty
Section titled “setCustomProperty”virtual void RObject::setCustomProperty(const QString &title, const QString &key, const QVariant &value)virtual
Sets a custom property with the given name.
Reimplemented in setCustomProperty.
setDocument
Section titled “setDocument”void RObject::setDocument(RDocument *document)setFlag
Section titled “setFlag”void RObject::setFlag(int flag, bool on=true)inline
setInvisible
Section titled “setInvisible”void RObject::setInvisible(bool on)inline
setProperty
Section titled “setProperty”virtual bool RObject::setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)virtual
Sets the given property to the given value.
If this property owner does not know a property with that ID, it is up to the property owner what happens. The property might be added into a list of dynamic properties or dropped.
Returns: True if the property owner was modified in any way, false otherwise.
Reimplemented in setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty.
setProtected
Section titled “setProtected”void RObject::setProtected(bool on)inline
setSelected
Section titled “setSelected”virtual void RObject::setSelected(bool on)virtual inline
Reimplemented in setSelected.
setWorkingSet
Section titled “setWorkingSet”virtual void RObject::setWorkingSet(bool on)virtual inline
validate
Section titled “validate”virtual bool RObject::validate()virtual inline
Reimplemented in validate.
getCustomPropertyAttributes
Section titled “getCustomPropertyAttributes”static RPropertyAttributes RObject::getCustomPropertyAttributes(const QString &title, const QString &key)static
Returns: attributes (read-only, invisible, …) for the given custom property.
getRtti
Section titled “getRtti”static RS::EntityType RObject::getRtti()static inline
static void RObject::init()static
setCustomPropertyAttributes
Section titled “setCustomPropertyAttributes”static void RObject::setCustomPropertyAttributes(const QString &title, const QString &key, const RPropertyAttributes &att)static
Set attributes (read-only, invisible, …) for the given custom property.
setMember
Section titled “setMember”template <class T>static bool RObject::setMember(T &variable, const QVariant &value, bool condition=true)static inline
Non-Scriptable: This function is not available in script environments.
INVALID_HANDLE
Section titled “INVALID_HANDLE”static const RObject::Handle RObject::INVALID_HANDLE = -1static
INVALID_ID
Section titled “INVALID_ID”static const RObject::Id RObject::INVALID_ID = -1static
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
PropertyCustom
Section titled “PropertyCustom”static RPropertyTypeId RObject::PropertyCustomstatic
PropertyHandle
Section titled “PropertyHandle”static RPropertyTypeId RObject::PropertyHandlestatic
PropertyInvisible
Section titled “PropertyInvisible”static RPropertyTypeId RObject::PropertyInvisiblestatic
PropertyProtected
Section titled “PropertyProtected”static RPropertyTypeId RObject::PropertyProtectedstatic
PropertySelected
Section titled “PropertySelected”static RPropertyTypeId RObject::PropertySelectedstatic
PropertyType
Section titled “PropertyType”static RPropertyTypeId RObject::PropertyTypestatic
PropertyWorkingSet
Section titled “PropertyWorkingSet”static RPropertyTypeId RObject::PropertyWorkingSetstatic
UNKNOWN_HANDLE
Section titled “UNKNOWN_HANDLE”static const RObject::Handle RObject::UNKNOWN_HANDLE = -2static
virtual void RObject::print(QDebug dbg) constvirtual const protected
Stream operator for QDebug.
Reimplemented in print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print.
setHandle
Section titled “setHandle”void RObject::setHandle(RObject::Handle h)inline protected
void RObject::setId(RObject::Id id)inline protected
setMemberFlag
Section titled “setMemberFlag”bool RObject::setMemberFlag(int flag, const QVariant &value, bool condition=true)protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Non-Scriptable: This function is not available in script environments.
setUndone
Section titled “setUndone”void RObject::setUndone(bool on)protected
setMember
Section titled “setMember”static bool RObject::setMember(bool &variable, const QVariant &value, bool condition=true)static protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Non-Scriptable: This function is not available in script environments.
setMember
Section titled “setMember”static bool RObject::setMember(double &variable, const QVariant &value, bool condition=true)static protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Non-Scriptable: This function is not available in script environments.
setMember
Section titled “setMember”static bool RObject::setMember(int &variable, const QVariant &value, bool condition=true)static protected
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Non-Scriptable: This function is not available in script environments.
setMember
Section titled “setMember”static bool RObject::setMember(QList< double > &variable, const QVariant &value, bool condition)static protected
Non-Scriptable: This function is not available in script environments.
Parameters:
value: A list for int / double pairs: QList<QPair<int, double> >
setMember
Section titled “setMember”static bool RObject::setMember(QList< int > &variable, const QVariant &value, bool condition)static protected
Non-Scriptable: This function is not available in script environments.
Parameters:
value: A list for int / int pairs: QList<QPair<int, int> >
setMember
Section titled “setMember”static bool RObject::setMember(QString &variable, const QVariant &value, bool condition=true)static protected
Sets the given property.
Non-Scriptable: This function is not available in script environments.
Parameters:
variable: a reference to the (member) variable we want to setvalue: the new valuecondition: the variable is only set to the new value if condition is true
Return values:
true: if condition is true and the value was successfully converted to the same type as the variable.
setMemberVector
Section titled “setMemberVector”static bool RObject::setMemberVector(QList< RVector > &variable, const QVariant &value, RObject::XYZ xyz)static protected
Non-Scriptable: This function is not available in script environments.
Parameters:
value: A QList of QPairs of int and double where the int is the index and the double the value.
setMemberX
Section titled “setMemberX”static bool RObject::setMemberX(QList< RVector > &variable, const QVariant &value, bool condition=true)static protected
Non-Scriptable: This function is not available in script environments.
Parameters:
value: A list of int / double pairs: QList<QPair<int, double> > representing indexes in the list and values.
setMemberY
Section titled “setMemberY”static bool RObject::setMemberY(QList< RVector > &variable, const QVariant &value, bool condition=true)static protected
Non-Scriptable: This function is not available in script environments.
Parameters:
value: A list of int / double pairs: QList<QPair<int, double> > representing indexes in the list and values.
setMemberZ
Section titled “setMemberZ”static bool RObject::setMemberZ(QList< RVector > &variable, const QVariant &value, bool condition=true)static protected
Non-Scriptable: This function is not available in script environments.
Parameters:
value: A list of int / double pairs: QList<QPair<int, double> > representing indexes in the list and values.
customProperties
Section titled “customProperties”QMap<QString, QVariantMap> RObject::customPropertiesprivate
AppID -> key -> value e.g.
‘QCAD’ -> ‘wall thickness’ -> 12.0; or ‘SomeApplication’ -> ‘00001_1000’ -> ‘SomeString’ where ‘00001’ is the position in the list of values and 1000 is the original DXF code from the file.
document
Section titled “document”RDocument* RObject::documentprivate
Flags RObject::flagsprivate
Object flags (undone, protected, …).
handle
Section titled “handle”Handle RObject::handleprivate
Handle of this object (from DXF / DWG).
objectId
Section titled “objectId”Id RObject::objectIdprivate
Unique ID of this object.
customPropertyAttributes
Section titled “customPropertyAttributes”static QMap< QString, QMap< QString, RPropertyAttributes > > RObject::customPropertyAttributesstatic private
Attributes of custom properties (read-only, invisible, …).
operator<<
Section titled “operator<<”QDebug operator<<(QDebug dbg, const RObject &o)inline
Non-Scriptable: This function is not available in script environments.
RStorage
Section titled “RStorage”friend class RStorageprivate