QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
ConductorTextItem Class Reference

#include <conductortextitem.h>

Inheritance diagram for ConductorTextItem:
Inheritance graph
Collaboration diagram for ConductorTextItem:
Collaboration graph

Public Types

enum  { Type = UserType + 1006 }
Public Types inherited from DiagramTextItem
enum  { Type = UserType + 1004 }

Public Member Functions

 ConductorTextItem (Conductor *=nullptr)
 ConductorTextItem (const QString &, Conductor *=nullptr)
 ~ConductorTextItem () override
ConductorparentConductor () const
void fromXml (const QDomElement &) override
 ConductorTextItem::fromXml Read the properties stored in the xml element given in parameter.
int type () const override
virtual bool wasMovedByUser () const
virtual bool wasRotatedByUser () const
 ConductorTextItem::wasRotatedByUser.
virtual void forceMovedByUser (bool)
virtual void forceRotateByUser (bool)
 ConductorTextItem::forceRotateByUser.
virtual void setPos (const QPointF &pos)
 ConductorTextItem::setPos.
virtual void setPos (qreal x, qreal y)
 ConductorTextItem::setPos.
Public Member Functions inherited from DiagramTextItem
 DiagramTextItem (QGraphicsItem *=nullptr)
 DiagramTextItem::DiagramTextItem.
 DiagramTextItem (const QString &, QGraphicsItem *=nullptr)
 DiagramTextItem::DiagramTextItem.
int type () const override
Diagramdiagram () const
 DiagramTextItem::diagram.
virtual QDomElement toXml (QDomDocument &) const
 DiagramTextItem::toXml This method do nothing and return an empty DomElement This is used to be inherited by child class.
void edit ()
 Edit the text with HtmlEditor.
QPointF mapMovementToScene (const QPointF &) const
QPointF mapMovementFromScene (const QPointF &) const
QPointF mapMovementToParent (const QPointF &) const
QPointF mapMovementFromParent (const QPointF &) const
void setFont (const QFont &font)
void setColor (const QColor &color)
QColor color () const
void setNoEditable (bool e=true)
void setAlignment (const Qt::Alignment &alignment)
Qt::Alignment alignment () const
QRectF frameRect () const
 DiagramTextItem::frameRect.
void setHtml (const QString &text)
void setPlainText (const QString &text)
bool isHtml () const

Protected Member Functions

void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 ConductorTextItem::mousePressEvent.
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 ConductorTextItem::mouseMoveEvent.
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 ConductorTextItem::mouseReleaseEvent.
void hoverEnterEvent (QGraphicsSceneHoverEvent *) override
void hoverLeaveEvent (QGraphicsSceneHoverEvent *) override
void hoverMoveEvent (QGraphicsSceneHoverEvent *) override
Protected Member Functions inherited from DiagramTextItem
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
 DiagramTextItem::paint Draw this text field. This method draws the text by calling QGraphicsTextItem::paint. If text is hovered, this method draws the bounding rect in grey.
void focusInEvent (QFocusEvent *) override
 DiagramTextItem::focusInEvent.
void focusOutEvent (QFocusEvent *) override
 DiagramTextItem::focusOutEvent.
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 DiagramTextItem::mousePressEvent.
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 DiagramTextItem::mouseMoveEvent.
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 DiagramTextItem::mouseReleaseEvent.
void hoverEnterEvent (QGraphicsSceneHoverEvent *) override
void hoverLeaveEvent (QGraphicsSceneHoverEvent *) override
void hoverMoveEvent (QGraphicsSceneHoverEvent *) override
virtual void applyRotation (const qreal &)
void prepareAlignment ()
 DiagramTextItem::prepareAlignment Call this function before changing the bounding rect of this text.
void finishAlignment ()
 DiagramTextItem::finishAlignment Call this function after changing the bounding rect of this text to set the position of this text according to the alignment property.

Private Member Functions

 ConductorTextItem (const ConductorTextItem &)

Private Attributes

Conductorparent_conductor_
bool moved_by_user_
bool rotate_by_user_
QPointF before_mov_pos_

Additional Inherited Members

Signals inherited from DiagramTextItem
void colorChanged (QColor color)
void alignmentChanged (Qt::Alignment alignment)
void textEdited (const QString &old_str, const QString &new_str)
void fontChanged (QFont font)
Public Attributes inherited from DiagramTextItem
bool m_block_alignment = false
Protected Attributes inherited from DiagramTextItem
bool m_mouse_hover = false
bool m_first_move = true
bool m_no_editable
bool m_is_html = false
bool m_non_left_alignment = false
QString m_previous_html_text
QString m_previous_text
QPointF m_mouse_to_origin_movement
Properties inherited from DiagramTextItem
QColor color
Qt::Alignment alignment
QString plainText
QFont font

Detailed Description

This class represents a text item attached to a parent conductor. It may be moved and edited by users. It may also be rotated to any angle. Its movements are however limited to a particular distance around its parent conductor.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ ConductorTextItem() [1/3]

ConductorTextItem::ConductorTextItem ( Conductor * parent_conductor = nullptr)

Constructeur

Parameters
parent_conductorConducteur auquel ce texte est rattache
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConductorTextItem() [2/3]

ConductorTextItem::ConductorTextItem ( const QString & text,
Conductor * parent_conductor = nullptr )

Constructeur

Parameters
textLe texte affiche par le champ de texte
parent_conductorConducteur auquel ce texte est rattache
Here is the call graph for this function:

◆ ~ConductorTextItem()

ConductorTextItem::~ConductorTextItem ( )
override

Destructeur

◆ ConductorTextItem() [3/3]

ConductorTextItem::ConductorTextItem ( const ConductorTextItem & )
private
Here is the call graph for this function:

Member Function Documentation

◆ forceMovedByUser()

void ConductorTextItem::forceMovedByUser ( bool moved_by_user)
virtual
Parameters
moved_by_usertrue pour que la position du texte soit consideree comme ayant ete definie par l'utilisateur (et donc soit sauvegardee), false pour remettre le texte a sa position originelle

◆ forceRotateByUser()

void ConductorTextItem::forceRotateByUser ( bool rotate_by_user)
virtual

ConductorTextItem::forceRotateByUser.

Parameters
rotate_by_usertrue pour que la rotation du texte soit consideree comme ayant ete definie par l'utilisateur (et donc soit sauvegardee), false pour remettre le texte a sont angle originelle

◆ fromXml()

void ConductorTextItem::fromXml ( const QDomElement & e)
overridevirtual

ConductorTextItem::fromXml Read the properties stored in the xml element given in parameter.

Parameters
e

Implements DiagramTextItem.

Here is the call graph for this function:

◆ hoverEnterEvent()

void ConductorTextItem::hoverEnterEvent ( QGraphicsSceneHoverEvent * e)
overrideprotected

When mouse over element change m_mouse_hover to true (used in paint() function )

Parameters
eQGraphicsSceneHoverEvent

◆ hoverLeaveEvent()

void ConductorTextItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent * e)
overrideprotected

When mouse over element leave the position change m_mouse_hover to false(used in paint() function )

Parameters
eQGraphicsSceneHoverEvent

◆ hoverMoveEvent()

void ConductorTextItem::hoverMoveEvent ( QGraphicsSceneHoverEvent * e)
overrideprotected

Do nothing default function .

Parameters
eQGraphicsSceneHoverEvent

◆ mouseMoveEvent()

void ConductorTextItem::mouseMoveEvent ( QGraphicsSceneMouseEvent * event)
overrideprotected

ConductorTextItem::mouseMoveEvent.

Parameters
event
Here is the call graph for this function:

◆ mousePressEvent()

void ConductorTextItem::mousePressEvent ( QGraphicsSceneMouseEvent * event)
overrideprotected

ConductorTextItem::mousePressEvent.

Parameters
event
Here is the call graph for this function:

◆ mouseReleaseEvent()

void ConductorTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * e)
overrideprotected

ConductorTextItem::mouseReleaseEvent.

Parameters
e
Here is the call graph for this function:

◆ parentConductor()

Conductor * ConductorTextItem::parentConductor ( ) const
Returns
le conducteur parent de ce champ de texte, ou 0 si celui-ci n'en a pas
Here is the caller graph for this function:

◆ setPos() [1/2]

void ConductorTextItem::setPos ( const QPointF & pos)
virtual

ConductorTextItem::setPos.

Parameters
pos
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPos() [2/2]

void ConductorTextItem::setPos ( qreal x,
qreal y )
virtual

ConductorTextItem::setPos.

Parameters
x
y
Here is the call graph for this function:

◆ type()

int ConductorTextItem::type ( ) const
inlineoverride

◆ wasMovedByUser()

bool ConductorTextItem::wasMovedByUser ( ) const
virtual
Returns
true si ce champ de texte a ete explictement deplace par l'utilisateur, false sinon

◆ wasRotatedByUser()

bool ConductorTextItem::wasRotatedByUser ( ) const
virtual

ConductorTextItem::wasRotatedByUser.

Returns
true if text was explicit moved by user else false
Here is the caller graph for this function:

Member Data Documentation

◆ before_mov_pos_

QPointF ConductorTextItem::before_mov_pos_
private

◆ moved_by_user_

bool ConductorTextItem::moved_by_user_
private

◆ parent_conductor_

Conductor* ConductorTextItem::parent_conductor_
private

◆ rotate_by_user_

bool ConductorTextItem::rotate_by_user_
private

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