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

The PartDynamicTextField class This class represents an editable dynamic text field which may be used to compose the drawing of an electrical element within the element editor. The field will remain editable once the element is added onto a diagram. More...

#include <partdynamictextfield.h>

Inheritance diagram for PartDynamicTextField:
Inheritance graph
Collaboration diagram for PartDynamicTextField:
Collaboration graph

Public Types

enum  { Type = UserType + 1110 }
 

Signals

void taggChanged (QString tagg)
 
void textChanged (QString text)
 
void textFromChanged (DynamicElementTextItem::TextFrom text_from)
 
void infoNameChanged (QString info)
 
void compositeTextChanged (QString text)
 
void colorChanged (QColor color)
 
void frameChanged (bool frame)
 
void textWidthChanged (qreal width)
 
void alignmentChanged (Qt::Alignment alignment)
 
void fontChanged (QFont font)
 

Public Member Functions

void setProperty (const char *name, const QVariant &value) override
 PROPERTY. More...
 
QVariant property (const char *name) const override
 
 PartDynamicTextField (QETElementEditor *editor, QGraphicsItem *parent=nullptr)
 
int type () const override
 
QString name () const override
 
QString xmlName () const override
 
bool isUseless () const override
 
QRectF sceneGeometricRect () const override
 
void startUserTransformation (const QRectF &initial_selection_rect) override
 PartDynamicTextField::startUserTransformation. More...
 
void handleUserTransformation (const QRectF &initial_selection_rect, const QRectF &new_selection_rect) override
 PartDynamicTextField::handleUserTransformation. More...
 
const QDomElement toXml (QDomDocument &dom_doc) const override
 PartDynamicTextField::toXml. More...
 
void fromXml (const QDomElement &dom_elmt) override
 PartDynamicTextField::fromXml. More...
 
void fromTextFieldXml (const QDomElement &dom_element)
 PartDynamicTextField::fromTextFieldXml Setup this text from the xml definition of a text field (The xml tagg of a text field is "input");. More...
 
DynamicElementTextItem::TextFrom textFrom () const
 PartDynamicTextField::textFrom. More...
 
void setTextFrom (DynamicElementTextItem::TextFrom text_from)
 PartDynamicTextField::setTextFrom Set the final text is created from. More...
 
QString text () const
 PartDynamicTextField::text. More...
 
void setText (const QString &text)
 PartDynamicTextField::setText Set the text of this text. More...
 
void setInfoName (const QString &info_name)
 
QString infoName () const
 PartDynamicTextField::infoName. More...
 
void setCompositeText (const QString &text)
 PartDynamicTextField::setCompositeText Set the composite text of this text item to text. More...
 
QString compositeText () const
 PartDynamicTextField::compositeText. More...
 
void setColor (const QColor &color)
 PartDynamicTextField::setColor. More...
 
QColor color () const
 PartDynamicTextField::color. More...
 
void setFrame (bool frame)
 
bool frame () const
 
void setTextWidth (qreal width)
 
void setPlainText (const QString &text)
 
void setAlignment (Qt::Alignment alignment)
 
Qt::Alignment alignment () const
 
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
 

Static Public Member Functions

static QString xmlTaggName ()
 

Protected Member Functions

void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 PartDynamicTextField::mouseMoveEvent. More...
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 PartDynamicTextField::mousePressEvent. More...
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 PartDynamicTextField::mouseReleaseEvent. More...
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 PartDynamicTextField::itemChange. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
- Protected Member Functions inherited from CustomElementPart
QList< QPointF > mapPoints (const QRectF &, const QRectF &, const QList< QPointF > &)
 

Properties

QString text
 
DynamicElementTextItem::TextFrom textFrom
 
QString infoName
 
QString compositeText
 
QColor color
 
bool frame
 
qreal textWidth
 
Qt::Alignment alignment
 
QFont font
 

Private Member Functions

void elementInfoChanged ()
 PartDynamicTextField::elementInfoChanged Used to up to date this text field, when the element information (see elementScene) changed. More...
 
void prepareAlignment ()
 
void finishAlignment ()
 

Private Attributes

QPointF m_origine_pos
 
QPointF m_saved_point
 
QString m_text
 
QString m_info_name
 
QString m_composite_text
 
DynamicElementTextItem::TextFrom m_text_from = DynamicElementTextItem::UserText
 
QUuid m_uuid
 
bool m_frame = false
 
bool m_first_add = true
 
bool m_block_alignment = false
 
qreal m_text_width = -1
 
Qt::Alignment m_alignment = Qt::AlignTop|Qt::AlignLeft
 
QRectF m_alignment_rect
 

Detailed Description

The PartDynamicTextField class This class represents an editable dynamic text field which may be used to compose the drawing of an electrical element within the element editor. The field will remain editable once the element is added onto a diagram.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ PartDynamicTextField()

PartDynamicTextField::PartDynamicTextField ( QETElementEditor editor,
QGraphicsItem *  parent = nullptr 
)
Here is the call graph for this function:

Member Function Documentation

◆ alignment()

Qt::Alignment PartDynamicTextField::alignment ( ) const

◆ alignmentChanged

void PartDynamicTextField::alignmentChanged ( Qt::Alignment  alignment)
signal
Here is the caller graph for this function:

◆ color()

QColor PartDynamicTextField::color ( ) const

PartDynamicTextField::color.

Returns
The color of this text

◆ colorChanged

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

◆ compositeText()

QString PartDynamicTextField::compositeText ( ) const

PartDynamicTextField::compositeText.

Returns
the composite text of this text

◆ compositeTextChanged

void PartDynamicTextField::compositeTextChanged ( QString  text)
signal
Here is the caller graph for this function:

◆ elementInfoChanged()

void PartDynamicTextField::elementInfoChanged ( )
private

PartDynamicTextField::elementInfoChanged Used to up to date this text field, when the element information (see elementScene) changed.

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

◆ finishAlignment()

void PartDynamicTextField::finishAlignment ( )
private
Here is the caller graph for this function:

◆ fontChanged

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

◆ frame()

bool PartDynamicTextField::frame ( ) const

◆ frameChanged

void PartDynamicTextField::frameChanged ( bool  frame)
signal
Here is the caller graph for this function:

◆ fromTextFieldXml()

void PartDynamicTextField::fromTextFieldXml ( const QDomElement &  dom_element)

PartDynamicTextField::fromTextFieldXml Setup this text from the xml definition of a text field (The xml tagg of a text field is "input");.

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

◆ fromXml()

void PartDynamicTextField::fromXml ( const QDomElement &  dom_elmt)
overridevirtual

PartDynamicTextField::fromXml.

Parameters
dom_elmt

Implements CustomElementPart.

Here is the call graph for this function:

◆ handleUserTransformation()

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

PartDynamicTextField::handleUserTransformation.

Parameters
initial_selection_rect
new_selection_rectHandle the user-induced transformation from initial_selection_rect to new_selection_rect

Implements CustomElementPart.

Here is the call graph for this function:

◆ infoName()

QString PartDynamicTextField::infoName ( ) const

PartDynamicTextField::infoName.

Returns
the info name of this text

◆ infoNameChanged

void PartDynamicTextField::infoNameChanged ( QString  info)
signal
Here is the caller graph for this function:

◆ isUseless()

bool PartDynamicTextField::isUseless ( ) const
inlineoverridevirtual
Returns
whether the primitive appears to be useless (e.g. 0-length line) Typically, useless primitives are discarded when saving the element.

Implements CustomElementPart.

◆ itemChange()

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

PartDynamicTextField::itemChange.

Parameters
change
value
Returns
Here is the call graph for this function:

◆ mouseMoveEvent()

void PartDynamicTextField::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

PartDynamicTextField::mouseMoveEvent.

Parameters
event
Here is the call graph for this function:

◆ mousePressEvent()

void PartDynamicTextField::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

◆ mouseReleaseEvent()

void PartDynamicTextField::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

PartDynamicTextField::mouseReleaseEvent.

Parameters
event
Here is the call graph for this function:

◆ name()

QString PartDynamicTextField::name ( ) const
overridevirtual
Returns
the name of the primitive

Implements CustomElementPart.

Here is the caller graph for this function:

◆ paint()

void PartDynamicTextField::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
overrideprotected
Here is the call graph for this function:

◆ prepareAlignment()

void PartDynamicTextField::prepareAlignment ( )
private
Here is the caller graph for this function:

◆ property()

QVariant PartDynamicTextField::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:

◆ sceneGeometricRect()

QRectF PartDynamicTextField::sceneGeometricRect ( ) const
inlineoverridevirtual

Implements CustomElementPart.

◆ setAlignment()

void PartDynamicTextField::setAlignment ( Qt::Alignment  alignment)
Here is the caller graph for this function:

◆ setColor()

void PartDynamicTextField::setColor ( const QColor &  color)

PartDynamicTextField::setColor.

Parameters
colorset text color to color
Here is the caller graph for this function:

◆ setCompositeText()

void PartDynamicTextField::setCompositeText ( const QString &  text)

PartDynamicTextField::setCompositeText Set the composite text of this text item to text.

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

◆ setFont()

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

◆ setFrame()

void PartDynamicTextField::setFrame ( bool  frame)
Here is the caller graph for this function:

◆ setInfoName()

void PartDynamicTextField::setInfoName ( const QString &  info_name)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlainText()

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

◆ setProperty()

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

PROPERTY.

Implements CustomElementPart.

Here is the call graph for this function:

◆ setText()

void PartDynamicTextField::setText ( const QString &  text)

PartDynamicTextField::setText Set the text of this text.

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

◆ setTextFrom()

void PartDynamicTextField::setTextFrom ( DynamicElementTextItem::TextFrom  text_from)

PartDynamicTextField::setTextFrom Set the final text is created from.

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

◆ setTextWidth()

void PartDynamicTextField::setTextWidth ( qreal  width)
Here is the caller graph for this function:

◆ startUserTransformation()

void PartDynamicTextField::startUserTransformation ( const QRectF &  initial_selection_rect)
overridevirtual

PartDynamicTextField::startUserTransformation.

Parameters
initial_selection_rectStart the user-induced transformation, provided this primitive is contained within the initial_selection_rect bounding rectangle.

Implements CustomElementPart.

◆ taggChanged

void PartDynamicTextField::taggChanged ( QString  tagg)
signal
Here is the caller graph for this function:

◆ text()

QString PartDynamicTextField::text ( ) const

PartDynamicTextField::text.

Returns
the text of this text

◆ textChanged

void PartDynamicTextField::textChanged ( QString  text)
signal
Here is the caller graph for this function:

◆ textFrom()

DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom ( ) const

PartDynamicTextField::textFrom.

Returns
what the final text is created from.

◆ textFromChanged

void PartDynamicTextField::textFromChanged ( DynamicElementTextItem::TextFrom  text_from)
signal
Here is the caller graph for this function:

◆ textWidthChanged

void PartDynamicTextField::textWidthChanged ( qreal  width)
signal
Here is the caller graph for this function:

◆ toXml()

const QDomElement PartDynamicTextField::toXml ( QDomDocument &  dom_doc) const
overridevirtual

PartDynamicTextField::toXml.

Parameters
dom_doc
Returns

Implements CustomElementPart.

Here is the call graph for this function:

◆ type()

int PartDynamicTextField::type ( ) const
inlineoverride

◆ xmlName()

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

Implements CustomElementPart.

Here is the caller graph for this function:

◆ xmlTaggName()

static QString PartDynamicTextField::xmlTaggName ( )
inlinestatic

Member Data Documentation

◆ m_alignment

Qt::Alignment PartDynamicTextField::m_alignment = Qt::AlignTop|Qt::AlignLeft
private

◆ m_alignment_rect

QRectF PartDynamicTextField::m_alignment_rect
private

◆ m_block_alignment

bool PartDynamicTextField::m_block_alignment = false
private

◆ m_composite_text

QString PartDynamicTextField::m_composite_text
private

◆ m_first_add

bool PartDynamicTextField::m_first_add = true
private

◆ m_frame

bool PartDynamicTextField::m_frame = false
private

◆ m_info_name

QString PartDynamicTextField::m_info_name
private

◆ m_origine_pos

QPointF PartDynamicTextField::m_origine_pos
private

◆ m_saved_point

QPointF PartDynamicTextField::m_saved_point
private

◆ m_text

QString PartDynamicTextField::m_text
private

◆ m_text_from

DynamicElementTextItem::TextFrom PartDynamicTextField::m_text_from = DynamicElementTextItem::UserText
private

◆ m_text_width

qreal PartDynamicTextField::m_text_width = -1
private

◆ m_uuid

QUuid PartDynamicTextField::m_uuid
private

Property Documentation

◆ alignment

Qt::Alignment PartDynamicTextField::alignment
readwrite

◆ color

QColor PartDynamicTextField::color
readwrite

◆ compositeText

QString PartDynamicTextField::compositeText
readwrite

◆ font

QFont PartDynamicTextField::font
readwrite

◆ frame

bool PartDynamicTextField::frame
readwrite

◆ infoName

QString PartDynamicTextField::infoName
readwrite

◆ text

QString PartDynamicTextField::text
readwrite

◆ textFrom

DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom
readwrite

◆ textWidth

qreal PartDynamicTextField::textWidth
readwrite

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