QGIS API Documentation  2.99.0-Master (9fdd060)
qgscomposeritemgroup.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposeritemgroup.h
3  ----------------------
4  begin : 2nd June 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 #ifndef QGSCOMPOSERITEMGROUP_H
18 #define QGSCOMPOSERITEMGROUP_H
19 
20 #include "qgis_core.h"
21 #include "qgis.h"
22 #include "qgscomposeritem.h"
23 #include <QSet>
24 
29 class CORE_EXPORT QgsComposerItemGroup: public QgsComposerItem
30 {
31  Q_OBJECT
32  public:
35 
37  virtual int type() const override { return ComposerItemGroup; }
38 
42  void addItem( QgsComposerItem *item ) override;
44  void removeItems() override;
46  void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr ) override;
47 
51  void setSceneRect( const QRectF &rectangle ) override;
52 
53  //overridden to also hide grouped items
54  virtual void setVisibility( const bool visible ) override;
55 
61  bool writeXml( QDomElement &elem, QDomDocument &doc ) const override;
62 
68  bool readXml( const QDomElement &itemElem, const QDomDocument &doc ) override;
69 
70  QSet<QgsComposerItem *> items() { return mItems; }
71 
72  signals:
73  void childItemDeleted( QgsComposerItem *item );
74 
75  public slots:
76  void itemDestroyed();
77 
78  protected:
79  void drawFrame( QPainter *p ) override;
80 
81  private:
82  QSet<QgsComposerItem *> mItems;
83  QRectF mBoundingRectangle;
84 };
85 
86 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
virtual void removeItems()
A item that forms part of a map composition.
QSet< QgsComposerItem * > items()
A container for grouping several QgsComposerItems.
virtual void drawFrame(QPainter *p)
Draw black frame around item.
virtual bool readXml(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
Graphics scene for map printing.
virtual void addItem(QgsComposerItem *item)
Composite operations for item groups do nothing per default.
friend class QgsComposerItemGroup
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...
virtual bool writeXml(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
virtual void setVisibility(const bool visible)
Sets visibility for item.
virtual int type() const override
Return correct graphics item type.