QElectroTech  0.70
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DiagramImageItem Class Reference

#include <diagramimageitem.h>

Public Types

enum  { Type = UserType + 1007 }
 

Public Member Functions

 DiagramImageItem (QetGraphicsItem *=nullptr)
 DiagramImageItem::DiagramImageItem Constructor without pixmap. More...
 
 DiagramImageItem (const QPixmap &pixmap, QetGraphicsItem *=nullptr)
 DiagramImageItem::DiagramImageItem Constructor with pixmap. More...
 
 ~DiagramImageItem () override
 DiagramImageItem::~DiagramImageItem Destructor. More...
 
int type () const override
 
virtual bool fromXml (const QDomElement &)
 DiagramImageItem::fromXml Load this image fro xml elemebt . More...
 
virtual QDomElement toXml (QDomDocument &) const
 
void editProperty () override
 DiagramImageItem::editProperty Open the approriate dialog to edit this image. More...
 
void setPixmap (const QPixmap &pixmap)
 DiagramImageItem::setPixmap Set the new pixmap to be draw. More...
 
QRectF boundingRect () const override
 DiagramImageItem::boundingRect the outer bounds of the item as a rectangle, if no pixmap are set, return a default QRectF. More...
 
QString name () const override
 DiagramImageItem::name. More...
 
- Public Member Functions inherited from QetGraphicsItem
 QetGraphicsItem (QGraphicsItem *parent=nullptr)
 QetGraphicsItem::QetGraphicsItem Default constructor. More...
 
 ~QetGraphicsItem () override=0
 
Diagramdiagram () const
 QetGraphicsItem::diagram return the diagram of this item. More...
 
virtual void setPos (const QPointF &p)
 QetGraphicsItem::setPos set the position of the item to p. More...
 
virtual void setPos (qreal x, qreal y)
 QetGraphicsItem::setPos set the position of the item. More...
 
virtual bool isMovable () const
 
virtual void setMovable (bool movable)
 
QET::GraphicsItemState state () const
 QetGraphicsItem::state. More...
 

Protected Member Functions

void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
 DiagramImageItem::paint Draw the pixmap. More...
 
- Protected Member Functions inherited from QetGraphicsItem
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mousePressEvent handle the mouse click. More...
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mouseDoubleClickEvent handle the mouse double click. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mouseMoveEvent handle mouse movement. More...
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 QetGraphicsItem::mouseReleaseEvent handle mouse release click. More...
 

Protected Attributes

QPixmap pixmap_
 
- Protected Attributes inherited from QetGraphicsItem
bool is_movable_
 
bool m_first_move
 
bool snap_to_grid_
 
QPointF m_mouse_to_origin_movement
 
QET::GraphicsItemState m_state = QET:: GIOK
 

Detailed Description

This class represents a selectable, movable and editable image on a diagram.

See also
QGraphicsItem::GraphicsItemFlags

Definition at line 31 of file diagramimageitem.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 42 of file diagramimageitem.h.

Constructor & Destructor Documentation

◆ DiagramImageItem() [1/2]

DiagramImageItem::DiagramImageItem ( QetGraphicsItem parent_item = nullptr)

DiagramImageItem::DiagramImageItem Constructor without pixmap.

Parameters
parent_itemthe parent graphics item

Definition at line 28 of file diagramimageitem.cpp.

◆ DiagramImageItem() [2/2]

DiagramImageItem::DiagramImageItem ( const QPixmap &  pixmap,
QetGraphicsItem parent_item = nullptr 
)

DiagramImageItem::DiagramImageItem Constructor with pixmap.

Parameters
pixmapthe pixmap to be draw
parent_itemthe parent graphic item

Definition at line 40 of file diagramimageitem.cpp.

References boundingRect().

◆ ~DiagramImageItem()

DiagramImageItem::~DiagramImageItem ( )
override

DiagramImageItem::~DiagramImageItem Destructor.

Definition at line 52 of file diagramimageitem.cpp.

Member Function Documentation

◆ boundingRect()

QRectF DiagramImageItem::boundingRect ( ) const
override

DiagramImageItem::boundingRect the outer bounds of the item as a rectangle, if no pixmap are set, return a default QRectF.

Returns
a QRectF represent the bounding rectangle

Definition at line 109 of file diagramimageitem.cpp.

References pixmap_.

Referenced by DiagramImageItem(), DiagramEventAddImage::mouseMoveEvent(), DiagramEventAddImage::mousePressEvent(), paint(), and setPixmap().

◆ editProperty()

void DiagramImageItem::editProperty ( )
overridevirtual

DiagramImageItem::editProperty Open the approriate dialog to edit this image.

Reimplemented from QetGraphicsItem.

Definition at line 86 of file diagramimageitem.cpp.

References QetGraphicsItem::diagram().

◆ fromXml()

bool DiagramImageItem::fromXml ( const QDomElement &  e)
virtual

DiagramImageItem::fromXml Load this image fro xml elemebt .

Parameters
e
Returns
true if succesfully load.

Definition at line 132 of file diagramimageitem.cpp.

References QetGraphicsItem::is_movable_, and setPixmap().

◆ name()

QString DiagramImageItem::name ( ) const
overridevirtual

DiagramImageItem::name.

Returns
the generic name of this item (picture)

Reimplemented from QetGraphicsItem.

Definition at line 122 of file diagramimageitem.cpp.

References QET::Icons::tr.

◆ paint()

void DiagramImageItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
overrideprotected

DiagramImageItem::paint Draw the pixmap.

Parameters
painterthe Qpainter to use for draw the pixmap
optionthe style option
widgetthe QWidget where we draw the pixmap

Definition at line 62 of file diagramimageitem.cpp.

References boundingRect(), and pixmap_.

◆ setPixmap()

void DiagramImageItem::setPixmap ( const QPixmap &  pixmap)

DiagramImageItem::setPixmap Set the new pixmap to be draw.

Parameters
pixmapthe new pixmap

Definition at line 98 of file diagramimageitem.cpp.

References boundingRect(), and pixmap_.

Referenced by fromXml().

◆ toXml()

QDomElement DiagramImageItem::toXml ( QDomDocument &  document) const
virtual
Parameters
documentLe document XML a utiliser
Returns
L'element XML representant l'image

Definition at line 166 of file diagramimageitem.cpp.

References QET::correctAngle(), QetGraphicsItem::is_movable_, and pixmap_.

◆ type()

int DiagramImageItem::type ( ) const
inlineoverride

Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a DiagramImageItem

Returns
the QGraphicsItem type

Definition at line 51 of file diagramimageitem.h.

References Type.

Member Data Documentation

◆ pixmap_

QPixmap DiagramImageItem::pixmap_
protected

Definition at line 64 of file diagramimageitem.h.

Referenced by boundingRect(), paint(), setPixmap(), and toXml().


The documentation for this class was generated from the following files: