4
4
* them in a list in ascending z-Order. This list can be changed to lower/raise items one position
5
5
* or to bring them to front/back.
6
6
* */
7
- class QgsComposition: QGraphicsScene
7
+ class QgsComposition : QGraphicsScene
8
8
{
9
9
%TypeHeaderCode
10
10
#include <qgscomposition.h>
11
11
%End
12
+
12
13
public:
13
14
14
15
/** \brief Plot type */
@@ -67,20 +68,27 @@ class QgsComposition: QGraphicsScene
67
68
/**Returns pointer to undo/redo command storage*/
68
69
QUndoStack* undoStack();
69
70
70
- /**Returns the topmose composer item. Ignores mPaperItem*/
71
+ /**Returns the topmost composer item. Ignores mPaperItem*/
71
72
QgsComposerItem* composerItemAt( const QPointF & position );
72
73
74
+ /** Returns the page number (0-bsaed) given a coordinate */
75
+ int pageNumberAt( const QPointF& position ) const;
76
+
77
+ /** Returns on which page number (0-based) is displayed an item */
78
+ int itemPageNumber( const QgsComposerItem* ) const;
79
+
73
80
QList<QgsComposerItem*> selectedComposerItems();
74
81
75
82
/**Returns pointers to all composer maps in the scene*/
76
- //todo: needs a new mapping for QList<const T*> ?
77
- // QList<const QgsComposerMap*> composerMapItems() const;
83
+ %If (QLISTCONSTPTR_CONVERSION)
84
+ QList<const QgsComposerMap*> composerMapItems() const;
85
+ %End
78
86
79
87
/**Return composer items of a specific type*/
80
88
// template<class T> void composerItems( QList<T*>& itemList );
81
89
82
90
/**Returns the composer map with specified id
83
- @return id or 0 pointer if the composer map item does not exist*/
91
+ @return QgsComposerMap or 0 pointer if the composer map item does not exist*/
84
92
const QgsComposerMap* getComposerMapById( int id ) const;
85
93
86
94
/*Returns the composer html with specified id (a string as named in the
@@ -111,7 +119,7 @@ class QgsComposition: QGraphicsScene
111
119
/**Returns pointer to map renderer of qgis map canvas*/
112
120
QgsMapRenderer* mapRenderer();
113
121
114
- QgsComposition::PlotStyle plotStyle();
122
+ QgsComposition::PlotStyle plotStyle() const ;
115
123
void setPlotStyle( QgsComposition::PlotStyle style );
116
124
117
125
/**Returns the pixel font size for a font that has point size set.
@@ -140,8 +148,13 @@ class QgsComposition: QGraphicsScene
140
148
@param doc xml document
141
149
@param mapsToRestore for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps on demand
142
150
@param addUndoCommands insert AddItem commands if true (e.g. for copy/paste)
143
- @param pos item position. Optional, take position from xml if 0*/
144
- //void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore, bool addUndoCommands = false, QPointF* pos = 0 );
151
+ @param pos item position. Optional, take position from xml if 0
152
+ @note not available in python bindings
153
+ */
154
+ /*
155
+ void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore = 0,
156
+ bool addUndoCommands = false, QPointF* pos = 0 );
157
+ */
145
158
146
159
/**Adds item to z list. Usually called from constructor of QgsComposerItem*/
147
160
void addItemToZList( QgsComposerItem* item );
@@ -192,7 +205,7 @@ class QgsComposition: QGraphicsScene
192
205
/**Removes multi frame (but does not delete it)*/
193
206
void removeMultiFrame( QgsComposerMultiFrame* multiFrame );
194
207
/**Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)*/
195
- // void addComposerArrow( QgsComposerArrow* arrow );
208
+ void addComposerArrow( QgsComposerArrow* arrow );
196
209
/**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
197
210
void addComposerLabel( QgsComposerLabel* label );
198
211
/**Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
@@ -219,10 +232,19 @@ class QgsComposition: QGraphicsScene
219
232
220
233
//printing
221
234
222
- void exportAsPDF( const QString& file );
235
+ /** Prepare the printer for printing */
236
+ void beginPrint( QPrinter& printer );
237
+ /** Prepare the printer for printing in a PDF */
238
+ void beginPrintAsPDF( QPrinter& printer, const QString& file );
239
+ /** Print on a preconfigured printer */
240
+ void doPrint( QPrinter& printer, QPainter& painter );
223
241
242
+ /** Convenience function that prepares the printer and prints */
224
243
void print( QPrinter &printer );
225
244
245
+ /** Convenience function that prepares the printer for printing in PDF and prints */
246
+ void exportAsPDF( const QString& file );
247
+
226
248
//! print composer page to image
227
249
//! If the image does not fit into memory, a null image is returned
228
250
QImage printPageAsRaster( int page );
0 commit comments