QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgspaperitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspaperitem.h
3  -------------------
4  begin : September 2008
5  copyright : (C) 2008 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
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 
18 #ifndef QGSPAPERITEM_H
19 #define QGSPAPERITEM_H
20 
21 #include "qgscomposeritem.h"
22 #include <QGraphicsRectItem>
23 
27 class CORE_EXPORT QgsPaperGrid: public QGraphicsRectItem
28 {
29  public:
30  QgsPaperGrid( double x, double y, double width, double height, QgsComposition* composition );
31  ~QgsPaperGrid();
32 
34  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ) override;
35 
36  private:
37  QgsComposition* mComposition;
38 };
39 
42 class CORE_EXPORT QgsPaperItem : public QgsComposerItem
43 {
44  Q_OBJECT
45 
46  public:
48  QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition );
49  ~QgsPaperItem();
50 
52  virtual int type() const override { return ComposerPaper; }
53 
55  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ) override;
56 
61  bool writeXML( QDomElement& elem, QDomDocument & doc ) const override;
62 
67  bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) override;
68 
69  virtual void setSceneRect( const QRectF& rectangle ) override;
70 
71  private:
72  QgsPaperItem();
74  void initialize();
75 
76  void calculatePageMargin();
77 
78  QgsPaperGrid* mPageGrid;
79  double mPageMargin;
80 };
81 
82 #endif
Item representing the paper.
Definition: qgspaperitem.h:42
virtual int type() const override
Return correct graphics item type.
Definition: qgspaperitem.h:52
A item that forms part of a map composition.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Item representing a grid.
Definition: qgspaperitem.h:27
Graphics scene for map printing.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...