QElectroTech
0.70
|
#include <parttext.h>
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) | |
virtual | ~CustomElementPart () |
Destructor. More... | |
virtual QETElementEditor * | elementEditor () const |
virtual void | updateCurrentPartEditor () const |
virtual ElementScene * | elementScene () 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 |
void | focusOutEvent (QFocusEvent *) override |
void | keyPressEvent (QKeyEvent *) override |
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 |
This class represents an static text primitive which may be used to compose the drawing of an electrical element within the element editor.
Definition at line 29 of file parttext.h.
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 53 of file parttext.h.
PartText::PartText | ( | QETElementEditor * | editor, |
QGraphicsItem * | parent = nullptr |
||
) |
Constructeur
editor | L'editeur d'element concerne |
parent | Le QGraphicsItem parent de ce texte statique |
Definition at line 30 of file parttext.cpp.
References adjustItemPosition(), QETApp::diagramTextsFont(), font, real_font_size_, setDefaultTextColor(), setFont(), setPlainText(), and QET::Icons::tr.
|
override |
Destructeur.
Definition at line 51 of file parttext.cpp.
|
private |
|
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).
new_block_count | Nombre de blocs dans le PartText |
Definition at line 304 of file parttext.cpp.
References margin().
Referenced by PartText().
|
overrideprotected |
Definition at line 188 of file parttext.cpp.
|
signal |
Referenced by setDefaultTextColor(), and TextEditor::setPart().
|
slot |
End text edition, potentially generating a ChangePartCommand if the text has changed.
Definition at line 341 of file parttext.cpp.
References previous_text, setEditable(), QET::Icons::tr, and CustomElementPart::undoStack().
Referenced by focusOutEvent(), and keyPressEvent().
|
overrideprotected |
QGraphicsItem::focusInEvent(QFocusEvent *)
e | The QFocusEvent object describing the focus gain. Start text edition when the item gains focus. |
Definition at line 128 of file parttext.cpp.
References startEdition().
|
overrideprotected |
QGraphicsItem::focusOutEvent(QFocusEvent *)
e | The QFocusEvent object describing the focus loss. End text edition when the item loses focus. |
Definition at line 139 of file parttext.cpp.
References endEdition().
|
signal |
Referenced by setFont(), and TextEditor::setPart().
|
overridevirtual |
Importe les proprietes d'un texte statique depuis un element XML
xml_element | Element XML a lire |
Implements CustomElementPart.
Definition at line 58 of file parttext.cpp.
References font, setDefaultTextColor(), setFont(), setPlainText(), and setRotation().
|
overridevirtual |
Handle the user-induced transformation from initial_selection_rect to new_selection_rect
Implements CustomElementPart.
Definition at line 226 of file parttext.cpp.
References CustomElementPart::mapPoints(), saved_font_size_, saved_point_, and setProperty().
|
overridevirtual |
Implements CustomElementPart.
Definition at line 199 of file parttext.cpp.
|
overrideprotected |
Gere les changements intervenant sur cette partie
change | Type de changement |
value | Valeur numerique relative au changement |
Definition at line 174 of file parttext.cpp.
References CustomElementPart::updateCurrentPartEditor().
|
overrideprotected |
QGraphicsTextItem::keyPressEvent() Used to handle the escape key when the event is delivered to the field, not to the decorator.
Definition at line 149 of file parttext.cpp.
References endEdition().
|
private |
Definition at line 108 of file parttext.cpp.
References font.
Referenced by adjustItemPosition().
|
overrideprotected |
Permet a l'element texte de devenir editable lorsqu'on double-clique dessus
e | Le QGraphicsSceneMouseEvent qui decrit le double-clic |
Definition at line 162 of file parttext.cpp.
References setEditable().
|
overrideprotected |
Definition at line 265 of file parttext.cpp.
References CustomElementPart::elementScene(), and m_origine_pos.
|
overrideprotected |
Definition at line 276 of file parttext.cpp.
References m_origine_pos.
|
overrideprotected |
Definition at line 284 of file parttext.cpp.
References CustomElementPart::elementScene(), QPropertyUndoCommand::enableAnimation(), m_origine_pos, QET::Icons::tr, and ElementScene::undoStack().
|
inlineoverridevirtual |
Implements CustomElementPart.
Definition at line 60 of file parttext.h.
References QET::Icons::tr.
Referenced by property(), setProperty(), and toXml().
|
signal |
Referenced by TextEditor::setPart(), and setPlainText().
|
inlineoverridevirtual |
Get the current value of a specific primitive property
Implements CustomElementPart.
Definition at line 71 of file parttext.h.
References name().
|
inline |
Definition at line 73 of file parttext.h.
References real_font_size_.
|
overridevirtual |
Implements CustomElementPart.
Definition at line 209 of file parttext.cpp.
void PartText::setDefaultTextColor | ( | const QColor & | color | ) |
Definition at line 237 of file parttext.cpp.
References color, and colorChanged().
Referenced by fromXml(), and PartText().
|
slot |
editable | Whether this text item should be interactively editable. |
Definition at line 317 of file parttext.cpp.
Referenced by endEdition(), and mouseDoubleClickEvent().
void PartText::setFont | ( | const QFont & | font | ) |
Definition at line 255 of file parttext.cpp.
References font, and fontChanged().
Referenced by fromXml(), and PartText().
void PartText::setPlainText | ( | const QString & | text | ) |
Definition at line 246 of file parttext.cpp.
References plainTextChanged(), and text.
Referenced by fromXml(), and PartText().
|
inlineoverridevirtual |
Set a specific property of the primitive
Implements CustomElementPart.
Definition at line 70 of file parttext.h.
References name().
Referenced by handleUserTransformation().
|
inline |
Definition at line 74 of file parttext.h.
References real_font_size_.
|
inline |
|
slot |
Start text edition by storing the former value of the text.
Definition at line 332 of file parttext.cpp.
References previous_text.
Referenced by focusInEvent().
|
overridevirtual |
Start the user-induced transformation, provided this primitive is contained within the rect bounding rectangle.
Implements CustomElementPart.
Definition at line 217 of file parttext.cpp.
References real_font_size_, saved_font_size_, and saved_point_.
|
overridevirtual |
Exporte le texte statique en XML
xml_document | Document XML a utiliser pour creer l'element XML |
Implements CustomElementPart.
Definition at line 91 of file parttext.cpp.
|
inlineoverride |
Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a PartText.
Definition at line 59 of file parttext.h.
References Type.
|
inlineoverridevirtual |
Implements CustomElementPart.
Definition at line 61 of file parttext.h.
Referenced by toXml().
|
private |
Definition at line 102 of file parttext.h.
|
private |
Definition at line 103 of file parttext.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Definition at line 98 of file parttext.h.
Referenced by endEdition(), and startEdition().
|
private |
Definition at line 99 of file parttext.h.
Referenced by PartText(), realSize(), setRealSize(), and startUserTransformation().
|
private |
Definition at line 101 of file parttext.h.
Referenced by handleUserTransformation(), and startUserTransformation().
|
private |
Definition at line 100 of file parttext.h.
Referenced by handleUserTransformation(), and startUserTransformation().
|
readwrite |
Definition at line 34 of file parttext.h.
Referenced by setDefaultTextColor().
|
readwrite |
Definition at line 36 of file parttext.h.
Referenced by fromXml(), margin(), PartText(), setFont(), and toXml().
|
readwrite |
Definition at line 33 of file parttext.h.
|
readwrite |
Definition at line 35 of file parttext.h.
Referenced by setPlainText().