44 * them in a list in ascending z-Order. This list can be changed to lower/raise items one position
55 * or to bring them to front/back.
66 * */
7- class QgsComposition : QGraphicsScene
7+ class QgsComposition : QGraphicsScene
88{
99%TypeHeaderCode
1010#include < qgscomposition.h>
1111%End
12+
1213 public:
1314
1415 /* * \brief Plot type */
@@ -67,20 +68,27 @@ class QgsComposition: QGraphicsScene
6768 /* *Returns pointer to undo/redo command storage*/
6869 QUndoStack* undoStack ();
6970
70- /* *Returns the topmose composer item. Ignores mPaperItem*/
71+ /* *Returns the topmost composer item. Ignores mPaperItem*/
7172 QgsComposerItem* composerItemAt ( const QPointF & position );
7273
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+
7380 QList<QgsComposerItem*> selectedComposerItems ();
7481
7582 /* *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
7886
7987 /* *Return composer items of a specific type*/
8088 // template<class T> void composerItems( QList<T*>& itemList );
8189
8290 /* *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*/
8492 const QgsComposerMap* getComposerMapById ( int id ) const ;
8593
8694 /* Returns the composer html with specified id (a string as named in the
@@ -111,7 +119,7 @@ class QgsComposition: QGraphicsScene
111119 /* *Returns pointer to map renderer of qgis map canvas*/
112120 QgsMapRenderer* mapRenderer ();
113121
114- QgsComposition::PlotStyle plotStyle ();
122+ QgsComposition::PlotStyle plotStyle () const ;
115123 void setPlotStyle ( QgsComposition::PlotStyle style );
116124
117125 /* *Returns the pixel font size for a font that has point size set.
@@ -140,8 +148,13 @@ class QgsComposition: QGraphicsScene
140148 @param doc xml document
141149 @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
142150 @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+ */
145158
146159 /* *Adds item to z list. Usually called from constructor of QgsComposerItem*/
147160 void addItemToZList ( QgsComposerItem* item );
@@ -192,7 +205,7 @@ class QgsComposition: QGraphicsScene
192205 /* *Removes multi frame (but does not delete it)*/
193206 void removeMultiFrame ( QgsComposerMultiFrame* multiFrame );
194207 /* *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 );
196209 /* *Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
197210 void addComposerLabel ( QgsComposerLabel* label );
198211 /* *Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
@@ -219,10 +232,19 @@ class QgsComposition: QGraphicsScene
219232
220233 // printing
221234
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 );
223241
242+ /* * Convenience function that prepares the printer and prints */
224243 void print ( QPrinter &printer );
225244
245+ /* * Convenience function that prepares the printer for printing in PDF and prints */
246+ void exportAsPDF ( const QString& file );
247+
226248 // ! print composer page to image
227249 // ! If the image does not fit into memory, a null image is returned
228250 QImage printPageAsRaster ( int page );
0 commit comments