QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
diagramimageitem.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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
23class QDomElement;
24class QDomDocument;
25
32 Q_OBJECT
33
34 // constructors, destructor
35 public:
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
Definition diagramimageitem.h:31
@ Type
Definition diagramimageitem.h:42
virtual bool fromXml(const QDomElement &)
DiagramImageItem::fromXml Load this image from xml element e.
Definition diagramimageitem.cpp:136
void setPixmap(const QPixmap &pixmap)
DiagramImageItem::setPixmap Set the new pixmap to be draw.
Definition diagramimageitem.cpp:100
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
DiagramImageItem::paint Draw the pixmap.
Definition diagramimageitem.cpp:64
QString name() const override
DiagramImageItem::name.
Definition diagramimageitem.cpp:125
void editProperty() override
DiagramImageItem::editProperty Open the appropriate dialog to edit this image.
Definition diagramimageitem.cpp:88
int type() const override
Definition diagramimageitem.h:51
virtual QDomElement toXml(QDomDocument &) const
Definition diagramimageitem.cpp:170
QRectF boundingRect() const override
DiagramImageItem::boundingRect the outer bounds of the item as a rectangle, if no pixmap are set,...
Definition diagramimageitem.cpp:111
~DiagramImageItem() override
DiagramImageItem::~DiagramImageItem Destructor.
Definition diagramimageitem.cpp:53
QPixmap pixmap_
Definition diagramimageitem.h:64
Definition qetgraphicsitem.h:28