QCAD
Open Source 2D CAD
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

void clear ()
 
virtual RDocumentVariablesclone () const
 
RLayer::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)
 
virtual RS::EntityType getType () const
 
RS::Unit getUnit () const
 
bool hasKnownVariable (RS::KnownVariable key) const
 
virtual bool isSelectedForPropertyEditing ()
 
virtual void print (QDebug dbg) const
 Stream operator for QDebug. More...
 
 RDocumentVariables (RDocument *document)
 
void setCurrentLayerId (RLayer::Id id)
 
void setDimensionFont (const QString &f)
 
void setKnownVariable (RS::KnownVariable key, const RVector &value)
 
void setKnownVariable (RS::KnownVariable key, const QVariant &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. More...
 
void setUnit (RS::Unit u)
 
virtual ~RDocumentVariables ()
 
- Public Member Functions inherited from RObject
void copyCustomPropertiesFrom (RObject *other, const QString &title=RDEFAULT_QSTRING)
 Copies all custom properties from the given object. More...
 
void dump () const
 
virtual int getComplexity () const
 
bool getCustomBoolProperty (const QString &title, const QString &key, bool defaultValue) const
 
double getCustomDoubleProperty (const QString &title, const QString &key, double defaultValue) const
 
int getCustomIntProperty (const QString &title, const QString &key, int defaultValue) const
 
QMap< QString, QVariantMap > getCustomProperties () const
 
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
 
RObject::Handle getHandle () const
 
RObject::Id getId () const
 
virtual QSet< RPropertyTypeIdgetPropertyTypeIds () const
 
bool hasCustomProperties () const
 
bool hasCustomProperty (const QString &title, const QString &key) const
 
bool hasCustomProperty (const QString &title, const QRegExp &key) const
 
virtual bool hasPropertyType (RPropertyTypeId propertyTypeId)
 
bool isProtected () const
 
bool isUndone () const
 
void removeCustomProperty (const QString &title, const QString &key)
 Removes the custom property with the given name. More...
 
 RObject (RDocument *document=NULL)
 
 RObject (const RObject &other)
 
virtual void setAutoUpdatesBlocked (bool on)
 
void setCustomProperty (const QString &title, const QString &key, const QVariant &value)
 Sets a custom property with the given name. More...
 
void setDocument (RDocument *document)
 
void setProtected (bool on)
 
virtual ~RObject ()
 

Static Public Member Functions

static void init ()
 
- Static Public Member Functions inherited from RObject
static void init ()
 
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-2017 by Andrew Mustun. More...
 
static RPropertyTypeId PropertyDimensionFont
 
static RPropertyTypeId PropertyHandle
 
static RPropertyTypeId PropertyLinetypeScale
 
static RPropertyTypeId PropertyProtected
 
static RPropertyTypeId PropertyUnit
 
- Static Public Attributes inherited from RObject
static const Handle INVALID_HANDLE = -1
 
static const Id INVALID_ID = -1
 Copyright (c) 2011-2017 by Andrew Mustun. More...
 
static RPropertyTypeId PropertyCustom
 
static RPropertyTypeId PropertyHandle
 
static RPropertyTypeId PropertyProtected
 
static RPropertyTypeId PropertyType
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from RObject
typedef int Handle
 
typedef int Id
 
enum  XYZ { X, Y, Z }
 
- Protected Member Functions inherited from RObject
void setHandle (RObject::Handle h)
 
void setId (RObject::Id id)
 
void setUndone (bool on)
 
- Static Protected Member Functions inherited from RObject
static bool setMember (QString &variable, const QVariant &value, bool condition=true)
 Sets the given property. More...
 
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. More...
 
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. More...
 
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. More...
 
static bool setMember (QList< double > &variable, const QVariant &value, bool condition)
 
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:
This class is available in script environments.
Shared Pointer Support:
Objects can be used in QSharedPointer.

Constructor & Destructor Documentation

RDocumentVariables::RDocumentVariables ( RDocument document)
RDocumentVariables::~RDocumentVariables ( )
virtual

Member Function Documentation

void RDocumentVariables::clear ( )
virtual RDocumentVariables* RDocumentVariables::clone ( ) const
inlinevirtual

Implements RObject.

RLayer::Id RDocumentVariables::getCurrentLayerId ( ) const
inline
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.

QString RDocumentVariables::getDimensionFont ( ) const
inline
QVariant RDocumentVariables::getKnownVariable ( RS::KnownVariable  key) const
double RDocumentVariables::getLinetypeScale ( ) const
inline
RS::Measurement RDocumentVariables::getMeasurement ( ) const
inline
QPair< QVariant, RPropertyAttributes > RDocumentVariables::getProperty ( RPropertyTypeId propertyTypeId,
bool  humanReadable = false,
bool  noAttributes = 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.

virtual RS::EntityType RDocumentVariables::getType ( ) const
inlinevirtual

Implements RObject.

RS::Unit RDocumentVariables::getUnit ( ) const
inline
bool RDocumentVariables::hasKnownVariable ( RS::KnownVariable  key) const
void RDocumentVariables::init ( )
static
virtual bool RDocumentVariables::isSelectedForPropertyEditing ( )
inlinevirtual
Returns
True if this object is selected for editing. This means that the properties of this object should for example be shown in a property editor.

Implements RObject.

void RDocumentVariables::print ( QDebug  dbg) const
virtual

Stream operator for QDebug.

Reimplemented from RObject.

void RDocumentVariables::setCurrentLayerId ( RLayer::Id  id)
inline
void RDocumentVariables::setDimensionFont ( const QString &  f)
inline
void RDocumentVariables::setKnownVariable ( RS::KnownVariable  key,
const RVector value 
)
void RDocumentVariables::setKnownVariable ( RS::KnownVariable  key,
const QVariant &  value 
)
void RDocumentVariables::setLinetypeScale ( double  s)
inline
void RDocumentVariables::setMeasurement ( RS::Measurement  m)
inline
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.

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

Member Data Documentation

RLayer::Id RDocumentVariables::currentLayerId
private
QString RDocumentVariables::dimensionFont
private
QHash<RS::KnownVariable, QVariant> RDocumentVariables::knownVariables
private
double RDocumentVariables::linetypeScale
private
RS::Measurement RDocumentVariables::measurement
private
RPropertyTypeId RDocumentVariables::PropertyCurrentLayerId
static
RPropertyTypeId RDocumentVariables::PropertyCustom
static

Copyright (c) 2011-2017 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.

RPropertyTypeId RDocumentVariables::PropertyDimensionFont
static
RPropertyTypeId RDocumentVariables::PropertyHandle
static
RPropertyTypeId RDocumentVariables::PropertyLinetypeScale
static
RPropertyTypeId RDocumentVariables::PropertyProtected
static
RPropertyTypeId RDocumentVariables::PropertyUnit
static
RS::Unit RDocumentVariables::unit
private

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