QElectroTech  0.8-dev
diagramimageitem.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The 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
QetGraphicsItem
Definition: qetgraphicsitem.h:27
qetgraphicsitem.h
propertieseditordialog.h
QetGraphicsItem::diagram
Diagram * diagram() const
Definition: qetgraphicsitem.cpp:40
DiagramImageItem::~DiagramImageItem
~DiagramImageItem() override
DiagramImageItem::~DiagramImageItem Destructor.
Definition: diagramimageitem.cpp:52
DiagramImageItem::type
int type() const override
Definition: diagramimageitem.h:51
DiagramImageItem::paint
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
DiagramImageItem::paint Draw the pixmap.
Definition: diagramimageitem.cpp:62
DiagramImageItem::setPixmap
void setPixmap(const QPixmap &pixmap)
DiagramImageItem::setPixmap Set the new pixmap to be draw.
Definition: diagramimageitem.cpp:98
DiagramImageItem
Definition: diagramimageitem.h:31
DiagramImageItem::name
QString name() const override
DiagramImageItem::name.
Definition: diagramimageitem.cpp:122
ImagePropertiesWidget
The ImagePropertiesWidget class This class provide a widget to edit the propertie of a DiagramImageIt...
Definition: imagepropertieswidget.h:34
DiagramImageItem::boundingRect
QRectF boundingRect() const override
DiagramImageItem::boundingRect the outer bounds of the item as a rectangle, if no pixmap are set,...
Definition: diagramimageitem.cpp:109
QET::correctAngle
qreal correctAngle(const qreal &)
Definition: qet.cpp:545
imagepropertieswidget.h
DiagramImageItem::fromXml
virtual bool fromXml(const QDomElement &)
DiagramImageItem::fromXml Load this image fro xml elemebt e.
Definition: diagramimageitem.cpp:132
QetGraphicsItem::is_movable_
bool is_movable_
Definition: qetgraphicsitem.h:56
DiagramImageItem::pixmap_
QPixmap pixmap_
Definition: diagramimageitem.h:64
DiagramImageItem::DiagramImageItem
DiagramImageItem(QetGraphicsItem *=nullptr)
DiagramImageItem::DiagramImageItem Constructor without pixmap.
Definition: diagramimageitem.cpp:28
DiagramImageItem::toXml
virtual QDomElement toXml(QDomDocument &) const
Definition: diagramimageitem.cpp:166
PropertiesEditorDialog
The PropertiesEditorDialog class Create a dialog to edit some properties of a thing....
Definition: propertieseditordialog.h:42
DiagramImageItem::Type
@ Type
Definition: diagramimageitem.h:42
diagramimageitem.h
DiagramImageItem::editProperty
void editProperty() override
DiagramImageItem::editProperty Open the approriate dialog to edit this image.
Definition: diagramimageitem.cpp:86
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
diagram.h