QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposerobject.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposerobject.h
3  -------------------
4  begin : July 2014
5  copyright : (C) 2014 by Nyall Dawson,Radim Blazek
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSCOMPOSEROBJECT_H
18 #define QGSCOMPOSEROBJECT_H
19 
20 #include <QObject>
21 #include <QDomNode>
22 #include <QPointF>
23 #include <QRectF>
24 #include <QMap>
25 
26 class QgsComposition;
27 class QPainter;
28 class QgsDataDefined;
29 
33 class CORE_EXPORT QgsComposerObject: public QObject
34 {
35  Q_OBJECT
36  public:
37 
41  {
42  NoProperty = 0,
45  //composer page properties
51  //general composer item properties
61  //composer map
69  //composer picture
71  //html item
72  SourceUrl
73  };
74 
80  {
81  EvaluatedValue = 0,
82  OriginalValue
83  };
84 
88  QgsComposerObject( QgsComposition* composition );
89  virtual ~QgsComposerObject();
90 
94  const QgsComposition* composition() const { return mComposition; }
95  QgsComposition* composition() { return mComposition; }
96 
101  virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
102 
107  virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
108 
113  QgsDataDefined* dataDefinedProperty( const DataDefinedProperty property ) const;
114 
123  void setDataDefinedProperty( const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field );
124 
125  public slots:
126 
128  virtual void repaint();
129 
137  virtual void refreshDataDefinedProperty( const DataDefinedProperty property = AllProperties );
138 
139  protected:
140 
142 
145 
152  bool dataDefinedEvaluate( const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue );
153 
154  signals:
158  void itemChanged();
159 
160  private slots:
164  void prepareDataDefinedExpressions() const;
165 
166  private:
167 
170 
171  friend class TestQgsComposerObject;
172 };
173 
174 #endif
A base class for objects which belong to a map composition.
A container class for data source field mapping or expression.
QMap< QgsComposerObject::DataDefinedProperty, QString > mDataDefinedNames
Map of data defined properties for the item to string name to use when exporting item to xml...
DataDefinedProperty
Data defined properties for different item types.
const QgsComposition * composition() const
Returns the composition the item is attached to.
QgsComposition * composition()
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
Graphics scene for map printing.
QgsComposition * mComposition