QElectroTech  0.70
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>

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
 
void setTextFrom (DynamicElementTextItem::TextFrom text_from)
 PartDynamicTextField::setTextFrom Set the final text is created from. More...
 
QString text () const
 
void setText (const QString &text)
 PartDynamicTextField::setText Set the text of this text. More...
 
void setInfoName (const QString &info_name)
 
QString infoName () const
 
void setCompositeText (const QString &text)
 PartDynamicTextField::setCompositeText Set the composite text of this text item to . More...
 
QString compositeText () const
 
void setColor (const QColor &color)
 PartDynamicTextField::setColor. More...
 
QColor color () const
 
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)
 
virtual ~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
 PartDynamicTextField::text. More...
 
DynamicElementTextItem::TextFrom textFrom
 PartDynamicTextField::textFrom. More...
 
QString infoName
 PartDynamicTextField::infoName. More...
 
QString compositeText
 PartDynamicTextField::compositeText. More...
 
QColor color
 PartDynamicTextField::color. More...
 
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.

Definition at line 32 of file partdynamictextfield.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 66 of file partdynamictextfield.h.

Constructor & Destructor Documentation

◆ PartDynamicTextField()

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

Member Function Documentation

◆ alignment()

Qt::Alignment PartDynamicTextField::alignment ( ) const

Referenced by fromXml(), setAlignment(), and toXml().

◆ alignmentChanged

void PartDynamicTextField::alignmentChanged ( Qt::Alignment  alignment)
signal

Referenced by setAlignment().

◆ color()

QColor PartDynamicTextField::color ( ) const

Referenced by paint(), setColor(), and toXml().

◆ colorChanged

void PartDynamicTextField::colorChanged ( QColor  color)
signal

◆ compositeText()

QString PartDynamicTextField::compositeText ( ) const

◆ compositeTextChanged

void PartDynamicTextField::compositeTextChanged ( QString  text)
signal

◆ elementInfoChanged()

void PartDynamicTextField::elementInfoChanged ( )
private

◆ finishAlignment()

void PartDynamicTextField::finishAlignment ( )
private

Definition at line 566 of file partdynamictextfield.cpp.

References m_alignment, m_alignment_rect, and m_block_alignment.

Referenced by setFont(), and setPlainText().

◆ fontChanged

void PartDynamicTextField::fontChanged ( QFont  font)
signal

◆ frame()

bool PartDynamicTextField::frame ( ) const

Referenced by setFrame().

◆ frameChanged

void PartDynamicTextField::frameChanged ( bool  frame)
signal

◆ 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

Definition at line 220 of file partdynamictextfield.cpp.

References QETApp::diagramTextsFont(), DynamicElementTextItem::ElementInfo, setFont(), setInfoName(), setText(), setTextFrom(), and DynamicElementTextItem::UserText.

Referenced by ElementScene::loadContent().

◆ fromXml()

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

◆ 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.

Definition at line 77 of file partdynamictextfield.cpp.

References m_saved_point, and CustomElementPart::mapPoints().

◆ infoName()

QString PartDynamicTextField::infoName ( ) const

◆ infoNameChanged

void PartDynamicTextField::infoNameChanged ( QString  info)
signal

◆ 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.

Definition at line 72 of file partdynamictextfield.h.

◆ itemChange()

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

◆ mouseMoveEvent()

void PartDynamicTextField::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

◆ mousePressEvent()

void PartDynamicTextField::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

PartDynamicTextField::mousePressEvent.

Parameters
event

Definition at line 449 of file partdynamictextfield.cpp.

References m_origine_pos.

◆ mouseReleaseEvent()

void PartDynamicTextField::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

◆ name()

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

Implements CustomElementPart.

Definition at line 49 of file partdynamictextfield.cpp.

References QET::Icons::tr.

Referenced by property(), setProperty(), and toXml().

◆ paint()

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

Definition at line 499 of file partdynamictextfield.cpp.

References color(), font, m_frame, and QET::Icons::ro.

◆ prepareAlignment()

void PartDynamicTextField::prepareAlignment ( )
private

Definition at line 561 of file partdynamictextfield.cpp.

References m_alignment_rect.

Referenced by setFont(), and setPlainText().

◆ property()

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

Get the current value of a specific primitive property

Implements CustomElementPart.

Definition at line 49 of file partdynamictextfield.h.

References name().

◆ sceneGeometricRect()

QRectF PartDynamicTextField::sceneGeometricRect ( ) const
inlineoverridevirtual

Implements CustomElementPart.

Definition at line 73 of file partdynamictextfield.h.

◆ setAlignment()

void PartDynamicTextField::setAlignment ( Qt::Alignment  alignment)

Definition at line 409 of file partdynamictextfield.cpp.

References alignment(), alignmentChanged(), and m_alignment.

Referenced by fromXml().

◆ setColor()

void PartDynamicTextField::setColor ( const QColor &  color)

PartDynamicTextField::setColor.

Parameters
colorset text color to color

Definition at line 348 of file partdynamictextfield.cpp.

References color(), and colorChanged().

Referenced by fromXml().

◆ setCompositeText()

void PartDynamicTextField::setCompositeText ( const QString &  text)

◆ setFont()

void PartDynamicTextField::setFont ( const QFont &  font)

◆ setFrame()

void PartDynamicTextField::setFrame ( bool  frame)

Definition at line 362 of file partdynamictextfield.cpp.

References frame(), frameChanged(), and m_frame.

Referenced by fromXml().

◆ setInfoName()

void PartDynamicTextField::setInfoName ( const QString &  info_name)

◆ setPlainText()

void PartDynamicTextField::setPlainText ( const QString &  text)

◆ setProperty()

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

PROPERTY.

Implements CustomElementPart.

Definition at line 48 of file partdynamictextfield.h.

References name().

◆ setText()

void PartDynamicTextField::setText ( const QString &  text)

PartDynamicTextField::setText Set the text of this text.

Parameters
text

Definition at line 300 of file partdynamictextfield.cpp.

References m_text, setPlainText(), text(), and textChanged().

Referenced by fromTextFieldXml(), and PartDynamicTextField().

◆ setTextFrom()

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

◆ setTextWidth()

void PartDynamicTextField::setTextWidth ( qreal  width)

Definition at line 374 of file partdynamictextfield.cpp.

References m_text_width, and textWidthChanged().

Referenced by fromXml(), and PartDynamicTextField().

◆ 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.

Definition at line 65 of file partdynamictextfield.cpp.

References m_saved_point.

◆ taggChanged

void PartDynamicTextField::taggChanged ( QString  tagg)
signal

◆ text()

QString PartDynamicTextField::text ( ) const

◆ textChanged

void PartDynamicTextField::textChanged ( QString  text)
signal

◆ textFrom()

DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom ( ) const

◆ textFromChanged

void PartDynamicTextField::textFromChanged ( DynamicElementTextItem::TextFrom  text_from)
signal

◆ textWidthChanged

void PartDynamicTextField::textWidthChanged ( qreal  width)
signal

◆ toXml()

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

◆ type()

int PartDynamicTextField::type ( ) const
inlineoverride

Definition at line 67 of file partdynamictextfield.h.

References Type.

◆ xmlName()

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

Implements CustomElementPart.

Definition at line 54 of file partdynamictextfield.cpp.

Referenced by fromXml(), and toXml().

◆ xmlTaggName()

static QString PartDynamicTextField::xmlTaggName ( )
inlinestatic

Definition at line 71 of file partdynamictextfield.h.

Member Data Documentation

◆ m_alignment

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

Definition at line 124 of file partdynamictextfield.h.

Referenced by finishAlignment(), and setAlignment().

◆ m_alignment_rect

QRectF PartDynamicTextField::m_alignment_rect
private

Definition at line 125 of file partdynamictextfield.h.

Referenced by finishAlignment(), and prepareAlignment().

◆ m_block_alignment

bool PartDynamicTextField::m_block_alignment = false
private

Definition at line 122 of file partdynamictextfield.h.

Referenced by finishAlignment(), and fromXml().

◆ m_composite_text

QString PartDynamicTextField::m_composite_text
private

◆ m_first_add

bool PartDynamicTextField::m_first_add = true
private

Definition at line 121 of file partdynamictextfield.h.

Referenced by itemChange().

◆ m_frame

bool PartDynamicTextField::m_frame = false
private

Definition at line 120 of file partdynamictextfield.h.

Referenced by paint(), setFrame(), and toXml().

◆ m_info_name

QString PartDynamicTextField::m_info_name
private

Definition at line 115 of file partdynamictextfield.h.

Referenced by elementInfoChanged(), fromXml(), setInfoName(), setTextFrom(), and toXml().

◆ m_origine_pos

QPointF PartDynamicTextField::m_origine_pos
private

Definition at line 113 of file partdynamictextfield.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

◆ m_saved_point

QPointF PartDynamicTextField::m_saved_point
private

Definition at line 113 of file partdynamictextfield.h.

Referenced by handleUserTransformation(), and startUserTransformation().

◆ m_text

QString PartDynamicTextField::m_text
private

Definition at line 115 of file partdynamictextfield.h.

Referenced by fromXml(), setText(), and setTextFrom().

◆ m_text_from

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

◆ m_text_width

qreal PartDynamicTextField::m_text_width = -1
private

Definition at line 123 of file partdynamictextfield.h.

Referenced by setPlainText(), setTextWidth(), and toXml().

◆ m_uuid

QUuid PartDynamicTextField::m_uuid
private

Definition at line 119 of file partdynamictextfield.h.

Referenced by fromXml(), and toXml().

Property Documentation

◆ alignment

Qt::Alignment PartDynamicTextField::alignment
readwrite

Definition at line 43 of file partdynamictextfield.h.

◆ color

QColor PartDynamicTextField::color
readwrite

PartDynamicTextField::color.

Returns
The color of this text

Definition at line 40 of file partdynamictextfield.h.

◆ compositeText

QString PartDynamicTextField::compositeText
readwrite

PartDynamicTextField::compositeText.

Returns
the composite text of this text

Definition at line 39 of file partdynamictextfield.h.

◆ font

QFont PartDynamicTextField::font
readwrite

Definition at line 44 of file partdynamictextfield.h.

Referenced by paint(), setFont(), and toXml().

◆ frame

bool PartDynamicTextField::frame
readwrite

Definition at line 41 of file partdynamictextfield.h.

◆ infoName

QString PartDynamicTextField::infoName
readwrite

PartDynamicTextField::infoName.

Returns
the info name of this text

Definition at line 38 of file partdynamictextfield.h.

◆ text

QString PartDynamicTextField::text
readwrite

PartDynamicTextField::text.

Returns
the text of this text

Definition at line 36 of file partdynamictextfield.h.

◆ textFrom

DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom
readwrite

PartDynamicTextField::textFrom.

Returns
what the final text is created from.

Definition at line 37 of file partdynamictextfield.h.

◆ textWidth

qreal PartDynamicTextField::textWidth
readwrite

Definition at line 42 of file partdynamictextfield.h.


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