QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RDocumentVariables Class Reference

This type of object is used to store document wide variables. More...

#include <RDocumentVariables.h>

Inheritance diagram for RDocumentVariables:
RObject

Public Member Functions

QString addAutoVariable (double value)
 
void clear ()
 
virtual QSharedPointer< RObjectclone () const
 
QSharedPointer< RDocumentVariablescloneToDocumentVariables () const
 
QStringList getAutoVariables () const
 
RObject::Id getCurrentLayerId () const
 
QSet< RPropertyTypeIdgetCustomPropertyTypeIds () const
 
QString getDimensionFont () const
 
QVariant getKnownVariable (RS::KnownVariable key) const
 
double getLinetypeScale () const
 
RS::Measurement getMeasurement () const
 
virtual QPair< QVariant, RPropertyAttributesgetProperty (RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
 
virtual RS::EntityType getType () const
 
RS::Unit getUnit () const
 
bool hasKnownVariable (RS::KnownVariable key) const
 
virtual void print (QDebug dbg) const
 Stream operator for QDebug.
 
 RDocumentVariables (RDocument *document)
 
void setCurrentLayerId (RObject::Id id)
 
void setDimensionFont (const QString &f)
 
void setKnownVariable (RS::KnownVariable key, const QVariant &value)
 
void setKnownVariable (RS::KnownVariable key, const RColor &value)
 
void setKnownVariable (RS::KnownVariable key, const RVector &value)
 
void setLinetypeScale (double s)
 
void setMeasurement (RS::Measurement m)
 
virtual bool setProperty (RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
 Sets the given property to the given value.
 
void setUnit (RS::Unit u)
 
virtual ~RDocumentVariables ()
 
- Public Member Functions inherited from RObject
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 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
 
RDocumentgetDocument ()
 
const RDocumentgetDocument () const
 
bool getFlag (int flag) const
 
RObject::Handle getHandle () const
 
RObject::Id getId () const
 
virtual QSet< RPropertyTypeIdgetPropertyTypeIds (RPropertyAttributes::Option option=RPropertyAttributes::NoOptions) 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) const
 Override 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.
 
 RObject (const RObject &other)
 
 RObject (RDocument *document=NULL)
 
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)
 
void setProtected (bool on)
 
virtual void setSelected (bool on)
 
virtual void setWorkingSet (bool on)
 
virtual bool validate ()
 
virtual ~RObject ()
 

Static Public Member Functions

static RS::EntityType getRtti ()
 
static void init ()
 
- Static Public Member Functions inherited from RObject
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.
 
template<class T >
static bool setMember (T &variable, const QVariant &value, bool condition=true)
 

Static Public Attributes

static RPropertyTypeId PropertyCurrentLayerId
 
static RPropertyTypeId PropertyCustom
 Copyright (c) 2011-2018 by Andrew Mustun.
 
static RPropertyTypeId PropertyDimensionFont
 
static RPropertyTypeId PropertyHandle
 
static RPropertyTypeId PropertyLinetypeScale
 
static RPropertyTypeId PropertyProtected
 
static RPropertyTypeId PropertyUnit
 
static RPropertyTypeId PropertyWorkingSetBlockReferenceId
 
- Static Public Attributes inherited from RObject
static const Handle INVALID_HANDLE = -1
 
static const Id INVALID_ID = -1
 Copyright (c) 2011-2018 by Andrew Mustun.
 
static RPropertyTypeId PropertyCustom
 
static RPropertyTypeId PropertyHandle
 
static RPropertyTypeId PropertyInvisible
 
static RPropertyTypeId PropertyProtected
 
static RPropertyTypeId PropertySelected
 
static RPropertyTypeId PropertyType
 
static RPropertyTypeId PropertyWorkingSet
 

Private Attributes

RObject::Id currentLayerId
 
QString dimensionFont
 
QHash< RS::KnownVariable, QVariant > knownVariables
 
double linetypeScale
 
RS::Measurement measurement
 
RS::Unit unit
 
RObject::Id workingSetBlockReferenceId
 

Additional Inherited Members

- Public Types inherited from RObject
typedef int Handle
 
typedef int Id
 
enum  ObjectFlag {
  NoFlags = 0x000 , Undone = 0x001 , Protect = 0x002 , Selected = 0x004 ,
  Invisible = 0x008 , WorkingSet = 0x010
}
 
enum  XYZ { X , Y , Z }
 
- Protected Member Functions inherited from RObject
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 Member Functions inherited from RObject
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)
 

Detailed Description

This type of object is used to store document wide variables.

Scriptable:\nThis class is available in script environments.\n
Shared Pointer Support:\nObjects can be used in QSharedPointer.\n

Constructor & Destructor Documentation

◆ RDocumentVariables()

RDocumentVariables::RDocumentVariables ( RDocument * document)

◆ ~RDocumentVariables()

RDocumentVariables::~RDocumentVariables ( )
virtual

Member Function Documentation

◆ addAutoVariable()

QString RDocumentVariables::addAutoVariable ( double value)

◆ clear()

void RDocumentVariables::clear ( )

◆ clone()

virtual QSharedPointer< RObject > RDocumentVariables::clone ( ) const
inlinevirtual

Implements RObject.

◆ cloneToDocumentVariables()

QSharedPointer< RDocumentVariables > RDocumentVariables::cloneToDocumentVariables ( ) const
inline

◆ getAutoVariables()

QStringList RDocumentVariables::getAutoVariables ( ) const

◆ getCurrentLayerId()

RObject::Id RDocumentVariables::getCurrentLayerId ( ) const
inline

◆ getCustomPropertyTypeIds()

QSet< RPropertyTypeId > RDocumentVariables::getCustomPropertyTypeIds ( ) const
virtual
Returns
A set of all custom property IDs of properties that are available for this object.

Reimplemented from RObject.

◆ getDimensionFont()

QString RDocumentVariables::getDimensionFont ( ) const
inline

◆ getKnownVariable()

QVariant RDocumentVariables::getKnownVariable ( RS::KnownVariable key) const

◆ getLinetypeScale()

double RDocumentVariables::getLinetypeScale ( ) const
inline

◆ getMeasurement()

RS::Measurement RDocumentVariables::getMeasurement ( ) const
inline

◆ getProperty()

QPair< QVariant, RPropertyAttributes > RDocumentVariables::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 from RObject.

◆ getRtti()

static RS::EntityType RDocumentVariables::getRtti ( )
inlinestatic

◆ getType()

virtual RS::EntityType RDocumentVariables::getType ( ) const
inlinevirtual
Returns
The unique entity type, usually the same as RTTI, different for custom entities.

Reimplemented from RObject.

◆ getUnit()

RS::Unit RDocumentVariables::getUnit ( ) const
inline

◆ hasKnownVariable()

bool RDocumentVariables::hasKnownVariable ( RS::KnownVariable key) const

◆ init()

void RDocumentVariables::init ( )
static

◆ print()

void RDocumentVariables::print ( QDebug dbg) const
virtual

Stream operator for QDebug.

Reimplemented from RObject.

◆ setCurrentLayerId()

void RDocumentVariables::setCurrentLayerId ( RObject::Id id)
inline

◆ setDimensionFont()

void RDocumentVariables::setDimensionFont ( const QString & f)
inline

◆ setKnownVariable() [1/3]

void RDocumentVariables::setKnownVariable ( RS::KnownVariable key,
const QVariant & value )

◆ setKnownVariable() [2/3]

void RDocumentVariables::setKnownVariable ( RS::KnownVariable key,
const RColor & value )

◆ setKnownVariable() [3/3]

void RDocumentVariables::setKnownVariable ( RS::KnownVariable key,
const RVector & value )

◆ setLinetypeScale()

void RDocumentVariables::setLinetypeScale ( double s)
inline

◆ setMeasurement()

void RDocumentVariables::setMeasurement ( RS::Measurement m)
inline

◆ setProperty()

bool RDocumentVariables::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 from RObject.

◆ setUnit()

void RDocumentVariables::setUnit ( RS::Unit u)
inline

Member Data Documentation

◆ currentLayerId

RObject::Id RDocumentVariables::currentLayerId
private

◆ dimensionFont

QString RDocumentVariables::dimensionFont
private

◆ knownVariables

QHash<RS::KnownVariable, QVariant> RDocumentVariables::knownVariables
private

◆ linetypeScale

double RDocumentVariables::linetypeScale
private

◆ measurement

RS::Measurement RDocumentVariables::measurement
private

◆ PropertyCurrentLayerId

RPropertyTypeId RDocumentVariables::PropertyCurrentLayerId
static

◆ PropertyCustom

RPropertyTypeId RDocumentVariables::PropertyCustom
static

Copyright (c) 2011-2018 by Andrew Mustun.

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.

◆ PropertyDimensionFont

RPropertyTypeId RDocumentVariables::PropertyDimensionFont
static

◆ PropertyHandle

RPropertyTypeId RDocumentVariables::PropertyHandle
static

◆ PropertyLinetypeScale

RPropertyTypeId RDocumentVariables::PropertyLinetypeScale
static

◆ PropertyProtected

RPropertyTypeId RDocumentVariables::PropertyProtected
static

◆ PropertyUnit

RPropertyTypeId RDocumentVariables::PropertyUnit
static

◆ PropertyWorkingSetBlockReferenceId

RPropertyTypeId RDocumentVariables::PropertyWorkingSetBlockReferenceId
static

◆ unit

RS::Unit RDocumentVariables::unit
private

◆ workingSetBlockReferenceId

RObject::Id RDocumentVariables::workingSetBlockReferenceId
private

The documentation for this class was generated from the following files: