QElectroTech  0.8-dev
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
PartText Class Reference

#include <parttext.h>

Inheritance diagram for PartText:
Inheritance graph
Collaboration diagram for PartText:
Collaboration graph

Public Types

enum  { Type = UserType + 1107 }
 

Public Slots

void adjustItemPosition (int=0)
 
void setEditable (bool)
 
void startEdition ()
 
void endEdition ()
 

Signals

void fontChanged (const QFont &font)
 
void colorChanged (const QColor &color)
 
void plainTextChanged (const QString &text)
 

Public Member Functions

 PartText (QETElementEditor *, QGraphicsItem *=nullptr)
 
 ~PartText () override
 Destructeur. More...
 
int type () const override
 
QString name () const override
 
QString xmlName () const override
 
void fromXml (const QDomElement &) override
 
const QDomElement toXml (QDomDocument &) const override
 
void setRotation (qreal angle)
 
bool isUseless () const override
 
QRectF sceneGeometricRect () const override
 
void startUserTransformation (const QRectF &) override
 
void handleUserTransformation (const QRectF &, const QRectF &) override
 
void setProperty (const char *name, const QVariant &value) override
 
QVariant property (const char *name) const override
 
qreal realSize () const
 
void setRealSize (qreal rs)
 
void setDefaultTextColor (const QColor &color)
 
void setPlainText (const QString &text)
 
void setFont (const QFont &font)
 
- Public Member Functions inherited from CustomElementPart
 CustomElementPart (QETElementEditor *editor)
 CustomElementPart Constructor. More...
 
virtual ~CustomElementPart ()
 ~CustomElementPart Destructor More...
 
virtual QETElementEditorelementEditor () const
 
virtual void updateCurrentPartEditor () const
 
virtual ElementSceneelementScene () const
 
virtual QUndoStack & undoStack () const
 
virtual QGraphicsItem * toItem ()
 
virtual QET::ScalingMethod preferredScalingMethod () const
 

Protected Member Functions

void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 
void focusInEvent (QFocusEvent *) override
 PartText::focusInEvent. More...
 
void focusOutEvent (QFocusEvent *) override
 PartText::focusOutEvent. More...
 
void keyPressEvent (QKeyEvent *) override
 PartText::keyPressEvent Used to handle the escape key when the event is delivered to the field, not to the decorator. More...
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *) override
 
QVariant itemChange (GraphicsItemChange, const QVariant &) override
 
QRectF boundingRect () const override
 
- Protected Member Functions inherited from CustomElementPart
QList< QPointF > mapPoints (const QRectF &, const QRectF &, const QList< QPointF > &)
 

Properties

qreal real_size
 
QColor color
 
QString text
 
QFont font
 

Private Member Functions

 PartText (const PartText &)
 
QPointF margin () const
 

Private Attributes

QString previous_text
 
qreal real_font_size_
 
QPointF saved_point_
 
qreal saved_font_size_
 
QGraphicsItem * decorator_
 
QPointF m_origine_pos
 

Detailed Description

This class represents an static text primitive which may be used to compose the drawing of an electrical element within the element editor.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ PartText() [1/2]

PartText::PartText ( QETElementEditor editor,
QGraphicsItem *  parent = nullptr 
)

Constructeur

Parameters
editorL'editeur d'element concerne
parentLe QGraphicsItem parent de ce texte statique
Here is the call graph for this function:

◆ ~PartText()

PartText::~PartText ( )
override

Destructeur.

◆ PartText() [2/2]

PartText::PartText ( const PartText )
private

Member Function Documentation

◆ adjustItemPosition

void PartText::adjustItemPosition ( int  new_block_count = 0)
slot

Cette methode s'assure que la position du champ de texte est coherente en repositionnant son origine (c-a-d le milieu du bord gauche du champ de texte) a la position originale. Cela est notamment utile lorsque le champ de texte est agrandi ou retreci verticalement (ajout ou retrait de lignes).

Parameters
new_block_countNombre de blocs dans le PartText
Here is the call graph for this function:
Here is the caller graph for this function:

◆ boundingRect()

QRectF PartText::boundingRect ( ) const
overrideprotected
Returns
le rectangle delimitant cette partie.

◆ colorChanged

void PartText::colorChanged ( const QColor &  color)
signal
Here is the caller graph for this function:

◆ endEdition

void PartText::endEdition ( )
slot

End text edition, potentially generating a ChangePartCommand if the text has changed.

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

◆ focusInEvent()

void PartText::focusInEvent ( QFocusEvent *  e)
overrideprotected

PartText::focusInEvent.

Parameters
e: The QFocusEvent object describing the focus gain. Start text edition when the item gains focus.
See also
QGraphicsItem::focusInEvent(QFocusEvent *)
Here is the call graph for this function:

◆ focusOutEvent()

void PartText::focusOutEvent ( QFocusEvent *  e)
overrideprotected

PartText::focusOutEvent.

Parameters
e: The QFocusEvent object describing the focus loss. End text edition when the item loses focus.
See also
QGraphicsItem::focusOutEvent(QFocusEvent *)
Here is the call graph for this function:

◆ fontChanged

void PartText::fontChanged ( const QFont &  font)
signal
Here is the caller graph for this function:

◆ fromXml()

void PartText::fromXml ( const QDomElement &  xml_element)
overridevirtual

Importe les proprietes d'un texte statique depuis un element XML

Parameters
xml_elementElement XML a lire

Implements CustomElementPart.

Here is the call graph for this function:

◆ handleUserTransformation()

void PartText::handleUserTransformation ( const QRectF &  initial_selection_rect,
const QRectF &  new_selection_rect 
)
overridevirtual

Handle the user-induced transformation from initial_selection_rect to new_selection_rect

Implements CustomElementPart.

Here is the call graph for this function:

◆ isUseless()

bool PartText::isUseless ( ) const
overridevirtual
Returns
true si cette partie n'est pas pertinente et ne merite pas d'etre conservee / enregistree. Un texte statique n'est pas pertinent lorsque son texte est vide.

Implements CustomElementPart.

◆ itemChange()

QVariant PartText::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overrideprotected

Gere les changements intervenant sur cette partie

Parameters
changeType de changement
valueValeur numerique relative au changement
Here is the call graph for this function:

◆ keyPressEvent()

void PartText::keyPressEvent ( QKeyEvent *  event)
overrideprotected

PartText::keyPressEvent Used to handle the escape key when the event is delivered to the field, not to the decorator.

Parameters
event
See also
QGraphicsTextItem::keyPressEvent()
Here is the call graph for this function:

◆ margin()

QPointF PartText::margin ( ) const
private
Returns
Les coordonnees du point situe en bas a gauche du texte.
Here is the caller graph for this function:

◆ mouseDoubleClickEvent()

void PartText::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  e)
overrideprotected

Permet a l'element texte de devenir editable lorsqu'on double-clique dessus

Parameters
eLe QGraphicsSceneMouseEvent qui decrit le double-clic
Here is the call graph for this function:

◆ mouseMoveEvent()

void PartText::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected
Here is the call graph for this function:

◆ mousePressEvent()

void PartText::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

◆ mouseReleaseEvent()

void PartText::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected
Here is the call graph for this function:

◆ name()

QString PartText::name ( ) const
inlineoverridevirtual
Returns
the name of the primitive

Implements CustomElementPart.

Here is the caller graph for this function:

◆ plainTextChanged

void PartText::plainTextChanged ( const QString &  text)
signal
Here is the caller graph for this function:

◆ property()

QVariant PartText::property ( const char *  name) const
inlineoverridevirtual

Get the current value of a specific primitive property

Implements CustomElementPart.

Here is the call graph for this function:

◆ realSize()

qreal PartText::realSize ( ) const
inline

◆ sceneGeometricRect()

QRectF PartText::sceneGeometricRect ( ) const
overridevirtual
Returns
the minimum, margin-less rectangle this part can fit into, in scene coordinates. It is different from boundingRect() because it is not supposed to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape.

Implements CustomElementPart.

◆ setDefaultTextColor()

void PartText::setDefaultTextColor ( const QColor &  color)
Here is the caller graph for this function:

◆ setEditable

void PartText::setEditable ( bool  editable)
slot
Parameters
editableWhether this text item should be interactively editable.
Here is the caller graph for this function:

◆ setFont()

void PartText::setFont ( const QFont &  font)
Here is the caller graph for this function:

◆ setPlainText()

void PartText::setPlainText ( const QString &  text)
Here is the caller graph for this function:

◆ setProperty()

void PartText::setProperty ( const char *  name,
const QVariant &  value 
)
inlineoverridevirtual

Set a specific property of the primitive

Implements CustomElementPart.

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

◆ setRealSize()

void PartText::setRealSize ( qreal  rs)
inline

◆ setRotation()

void PartText::setRotation ( qreal  angle)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startEdition

void PartText::startEdition ( )
slot

Start text edition by storing the former value of the text.

Here is the caller graph for this function:

◆ startUserTransformation()

void PartText::startUserTransformation ( const QRectF &  rect)
overridevirtual

Start the user-induced transformation, provided this primitive is contained within the rect bounding rectangle.

Implements CustomElementPart.

◆ toXml()

const QDomElement PartText::toXml ( QDomDocument &  xml_document) const
overridevirtual

Exporte le texte statique en XML

Parameters
xml_documentDocument XML a utiliser pour creer l'element XML
Returns
un element XML decrivant le texte statique

Implements CustomElementPart.

Here is the call graph for this function:

◆ type()

int PartText::type ( ) const
inlineoverride

Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a PartText.

Returns
the QGraphicsItem type

◆ xmlName()

QString PartText::xmlName ( ) const
inlineoverridevirtual
Returns
the name that will be used as XML tag when exporting the primitive

Implements CustomElementPart.

Here is the caller graph for this function:

Member Data Documentation

◆ decorator_

QGraphicsItem* PartText::decorator_
private

◆ m_origine_pos

QPointF PartText::m_origine_pos
private

◆ previous_text

QString PartText::previous_text
private

◆ real_font_size_

qreal PartText::real_font_size_
private

◆ saved_font_size_

qreal PartText::saved_font_size_
private

◆ saved_point_

QPointF PartText::saved_point_
private

Property Documentation

◆ color

QColor PartText::color
readwrite

◆ font

QFont PartText::font
readwrite

◆ real_size

qreal PartText::real_size
readwrite

◆ text

QString PartText::text
readwrite

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