QElectroTech  0.70
diagramimageitem.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2013 QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef DIAGRAM_IMAGE_ITEM_H
19 #define DIAGRAM_IMAGE_ITEM_H
20 
21 #include "qetgraphicsitem.h"
22 
23 class QDomElement;
24 class QDomDocument;
25 
32  Q_OBJECT
33 
34  // constructors, destructor
35  public:
36  DiagramImageItem(QetGraphicsItem * = nullptr);
37  DiagramImageItem(const QPixmap &pixmap, QetGraphicsItem * = nullptr);
38  ~DiagramImageItem() override;
39 
40  // attributes
41  public:
42  enum { Type = UserType + 1007 };
43 
44  // methods
45  public:
51  int type() const override { return Type; }
52 
53  virtual bool fromXml(const QDomElement &);
54  virtual QDomElement toXml(QDomDocument &) const;
55  void editProperty() override;
56  void setPixmap(const QPixmap &pixmap);
57  QRectF boundingRect() const override;
58  QString name() const override;
59 
60  protected:
61  void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
62 
63  protected:
64  QPixmap pixmap_;
65 };
66 #endif
~DiagramImageItem() override
DiagramImageItem::~DiagramImageItem Destructor.
QRectF boundingRect() const override
DiagramImageItem::boundingRect the outer bounds of the item as a rectangle, if no pixmap are set...
DiagramImageItem(QetGraphicsItem *=nullptr)
DiagramImageItem::DiagramImageItem Constructor without pixmap.
virtual bool fromXml(const QDomElement &)
DiagramImageItem::fromXml Load this image fro xml elemebt .
virtual QDomElement toXml(QDomDocument &) const
QString name() const override
DiagramImageItem::name.
void setPixmap(const QPixmap &pixmap)
DiagramImageItem::setPixmap Set the new pixmap to be draw.
int type() const override
void editProperty() override
DiagramImageItem::editProperty Open the approriate dialog to edit this image.
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
DiagramImageItem::paint Draw the pixmap.