QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QgsComposerObject Class Reference

A base class for objects which belong to a map composition. More...

#include <qgscomposerobject.h>

Inheritance diagram for QgsComposerObject:
Inheritance graph
[legend]

Public Types

enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, BlendMode,
  ExcludeFromExports, MapRotation, MapScale, MapXMin,
  MapYMin, MapXMax, MapYMax, MapAtlasMargin,
  PictureSource, SourceUrl
}
 Data defined properties for different item types. More...
enum  PropertyValueType { EvaluatedValue = 0, OriginalValue }
 Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More...

Public Slots

virtual void repaint ()
 Triggers a redraw for the item.
virtual void refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties)
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value.

Signals

void itemChanged ()
 Emitted when the item changes.

Public Member Functions

 QgsComposerObject (QgsComposition *composition)
 Constructor.
virtual ~QgsComposerObject ()
const QgsCompositioncomposition () const
 Returns the composition the item is attached to.
QgsCompositioncomposition ()
virtual bool writeXML (QDomElement &elem, QDomDocument &doc) const
 Stores item state in DOM element.
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc)
 Sets item state from DOM element.
QgsDataDefineddataDefinedProperty (const DataDefinedProperty property) const
 Returns a reference to the data defined settings for one of the item's data defined properties.
void setDataDefinedProperty (const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field)
 Sets parameters for a data defined property for the item.

Protected Member Functions

bool dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue)
 Evaluate a data defined property and return the calculated value.

Protected Attributes

QgsCompositionmComposition
QMap
< QgsComposerObject::DataDefinedProperty,
QString > 
mDataDefinedNames
 Map of data defined properties for the item to string name to use when exporting item to xml.

Friends

class TestQgsComposerObject

Detailed Description

A base class for objects which belong to a map composition.

Member Enumeration Documentation

Data defined properties for different item types.

Enumerator:
NoProperty 
AllProperties 
TestProperty 
PresetPaperSize 
PaperWidth 
PaperHeight 
NumPages 
PaperOrientation 
PageNumber 
PositionX 
PositionY 
ItemWidth 
ItemHeight 
ItemRotation 
Transparency 
BlendMode 
ExcludeFromExports 
MapRotation 
MapScale 
MapXMin 
MapYMin 
MapXMax 
MapYMax 
MapAtlasMargin 
PictureSource 
SourceUrl 

Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property.

This may differ if a property has a data defined expression active.

Enumerator:
EvaluatedValue 
OriginalValue 

Constructor & Destructor Documentation

QgsComposerObject::QgsComposerObject ( QgsComposition composition)

Constructor.

Parameters
compositionparent composition
QgsComposerObject::~QgsComposerObject ( )
virtual

Member Function Documentation

const QgsComposition* QgsComposerObject::composition ( ) const
inline

Returns the composition the item is attached to.

Returns
QgsComposition for item.
QgsComposition* QgsComposerObject::composition ( )
inline

Reimplemented in QgsComposerMultiFrame.

bool QgsComposerObject::dataDefinedEvaluate ( const QgsComposerObject::DataDefinedProperty  property,
QVariant &  expressionValue 
)
protected

Evaluate a data defined property and return the calculated value.

Returns
true if data defined property could be successfully evaluated
Parameters
propertydata defined property to evaluate
expressionValueQVariant for storing the evaluated value
Note
this method was added in version 2.5
QgsDataDefined * QgsComposerObject::dataDefinedProperty ( const DataDefinedProperty  property) const

Returns a reference to the data defined settings for one of the item's data defined properties.

Parameters
propertydata defined property to return
Note
this method was added in version 2.5
void QgsComposerObject::itemChanged ( )
signal

Emitted when the item changes.

Signifies that the item widgets must update the gui elements.

bool QgsComposerObject::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc 
)
virtual
void QgsComposerObject::refreshDataDefinedProperty ( const DataDefinedProperty  property = AllProperties)
virtualslot

Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value.

Parameters
propertydata defined property to refresh. If property is set to QgsComposerItem::AllProperties then all data defined properties for the item will be refreshed.
Note
this method was added in version 2.5
void QgsComposerObject::repaint ( )
virtualslot

Triggers a redraw for the item.

void QgsComposerObject::setDataDefinedProperty ( const DataDefinedProperty  property,
const bool  active,
const bool  useExpression,
const QString &  expression,
const QString &  field 
)

Sets parameters for a data defined property for the item.

Parameters
propertydata defined property to set
activetrue if data defined property is active, false if it is disabled
useExpressiontrue if the expression should be used
expressionexpression for data defined property
fieldfield name if the data defined property should take its value from a field
Note
this method was added in version 2.5
bool QgsComposerObject::writeXML ( QDomElement &  elem,
QDomDocument &  doc 
) const
virtual

Friends And Related Function Documentation

friend class TestQgsComposerObject
friend

Member Data Documentation

QgsComposition* QgsComposerObject::mComposition
protected
QMap< QgsComposerObject::DataDefinedProperty, QString > QgsComposerObject::mDataDefinedNames
protected

Map of data defined properties for the item to string name to use when exporting item to xml.


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