QElectroTech
0.8-dev
|
The DynamicElementTextItem class This class provide a simple text field of element who can be added or removed directly from the diagram editor. This text is created to compensate a big lack of the ElementTextItem : ElementTextItem can't be added or removed directly in the diagram editor. More...
#include <dynamicelementtextitem.h>
Public Types | |
enum | TextFrom { UserText, ElementInfo, CompositeText } |
enum | { Type = UserType + 1010 } |
Public Types inherited from DiagramTextItem | |
enum | { Type = UserType + 1004 } |
Signals | |
void | textChanged (QString text) |
void | textFromChanged (DynamicElementTextItem::TextFrom text_from) |
void | infoNameChanged (QString info) |
void | compositeTextChanged (QString text) |
void | frameChanged (bool frame) |
void | plainTextChanged () |
void | textWidthChanged (qreal width) |
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 Member Functions | |
int | type () const override |
DynamicElementTextItem (Element *parent_element) | |
DynamicElementTextItem::DynamicElementTextItem Constructor. More... | |
~DynamicElementTextItem () override | |
QDomElement | toXml (QDomDocument &dom_doc) const override |
DynamicElementTextItem::toXml Export this text to xml. More... | |
void | fromXml (const QDomElement &dom_elmt) override |
DynamicElementTextItem::fromXml Import this text from xml. More... | |
Element * | parentElement () const |
DynamicElementTextItem::ParentElement. More... | |
ElementTextItemGroup * | parentGroup () const |
DynamicElementTextItem::parentGroup. More... | |
Element * | elementUseForInfo () const |
DynamicElementTextItem::elementUseForInfo. More... | |
void | refreshLabelConnection () |
DynamicElementTextItem::refreshLabelConnection Refresh the connection of this text when the source of text is label, or composite text, with a variable %{label}. More... | |
DynamicElementTextItem::TextFrom | textFrom () const |
DynamicElementTextItem::textFrom. More... | |
void | setTextFrom (DynamicElementTextItem::TextFrom text_from) |
DynamicElementTextItem::setTextFrom Set the final text is created from. More... | |
QString | text () const |
DynamicElementTextItem::text. More... | |
void | setText (const QString &text) |
DynamicElementTextItem::setText Set the text of this text. More... | |
void | setInfoName (const QString &info_name) |
DynamicElementTextItem::setInfoName Set the information name of the parent element. More... | |
QString | infoName () const |
DynamicElementTextItem::infoName. More... | |
void | setCompositeText (const QString &text) |
DynamicElementTextItem::setCompositeText Set the composite text of this text item to text. More... | |
QString | compositeText () const |
DynamicElementTextItem::compositeText. More... | |
void | setFrame (const bool frame) |
bool | frame () const |
QUuid | uuid () const |
void | updateXref () |
DynamicElementTextItem::updateXref Create or delete the Xref according to the current properties of the project. More... | |
void | setPlainText (const QString &text) |
void | setTextWidth (qreal width) |
void | setXref_item (Qt::AlignmentFlag m_exHrefPos) |
Public Member Functions inherited from DiagramTextItem | |
DiagramTextItem (QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. More... | |
DiagramTextItem (const QString &, QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. More... | |
int | type () const override |
Diagram * | diagram () const |
DiagramTextItem::diagram. More... | |
void | edit () |
Edit the text with HtmlEditor. More... | |
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. More... | |
void | setHtml (const QString &text) |
void | setPlainText (const QString &text) |
bool | isHtml () const |
Static Public Member Functions | |
static QMetaEnum | textFromMetaEnum () |
DynamicElementTextItem::textFromMetaEnum. More... | |
static QString | xmlTagName () |
Protected Member Functions | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mousePressEvent. More... | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mouseMoveEvent. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mouseReleaseEvent. More... | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mouseDoubleClickEvent Reimplemented functions, for add extra feature when this text is owned by a slave. In this case if the parent slave element is linked to a master, and this text display the label of the master (both if the 'text from' is 'element info' or 'composite text') the QGraphicsView go to master and select it. More... | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
DynamicElementTextItem::hoverEnterEvent If the parent element of this text is a folio report or a slave element, the element is linked and the text display the variable "label" we set the text blue for signal the user that the text act like a link when we double click on. More... | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
DynamicElementTextItem::hoverLeaveEvent. More... | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
Protected Member Functions inherited from DiagramTextItem | |
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
DiagramTextItem::paint Draw this text field. This method draw the text by calling QGraphicsTextItem::paint. If text is hovered, this method draw the bounding rect in grey. More... | |
void | focusInEvent (QFocusEvent *) override |
DiagramTextItem::focusInEvent. More... | |
void | focusOutEvent (QFocusEvent *) override |
DiagramTextItem::focusOutEvent. More... | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mousePressEvent. More... | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mouseMoveEvent. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mouseReleaseEvent. More... | |
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. More... | |
void | finishAlignment () |
DiagramTextItem::finishAlignment Call this function after changing the bouding rect of this text to set the position of this text according to the alignment property. More... | |
Properties | |
QString | text |
TextFrom | textFrom |
QString | infoName |
QString | compositeText |
bool | frame |
qreal | textWidth |
Properties inherited from DiagramTextItem | |
QColor | color |
Qt::Alignment | alignment |
QString | plainText |
QFont | font |
Private Member Functions | |
DynamicElementTextItem () | |
DynamicElementTextItem (const DynamicElementTextItem &) | |
void | elementInfoChanged () |
void | masterChanged () |
DynamicElementTextItem::masterChanged This function is only use when the parent element is a slave. Call when the master element linked to the parent slave element of this text change. More... | |
void | reportChanged () |
DynamicElementTextItem::reportChanged This function is only use when parent element of this text is a folio report The linked report of the parent element was changed. More... | |
void | reportFormulaChanged () |
DynamicElementTextItem::reportFormulaChanged The report formula use in the project was changed. More... | |
void | setConnectionForReportFormula (const QString &formula) |
void | removeConnectionForReportFormula (const QString &formula) |
void | setupFormulaConnection () |
DynamicElementTextItem::setupFormulaConnection Setup the required connection for the formula of the label. More... | |
void | clearFormulaConnection () |
void | updateReportFormulaConnection () |
void | updateReportText () |
DynamicElementTextItem::updateReportText This function is only use when this text is owned by a report, and this text have for info the Label. More... | |
void | updateLabel () |
DynamicElementTextItem::updateLabel Update the displayed text, when this dynamic text is based on the label of the parent element. This function is notably use when the label itself is based from a formula. If this dynamic text isn't based on label, this function do nothing. More... | |
void | conductorWasAdded (Conductor *conductor) |
DynamicElementTextItem::conductorWasAdded Function only use when parent element is a folio report. More... | |
void | conductorWasRemoved (Conductor *conductor) |
DynamicElementTextItem::conductorWasRemoved Function only use when parent element is a folio report. More... | |
void | setPotentialConductor () |
DynamicElementTextItem::setPotentialConductor This function is only used when the parent element of this text is a report element Get a conductor in the potential of the parent report. More... | |
void | conductorPropertiesChanged () |
DynamicElementTextItem::conductorPropertiesChanged This function is only used when the parent element of this text is a report element. More... | |
QString | reportReplacedCompositeText () const |
DynamicElementTextItem::reportReplacedCompositeText This function is only used when the parent element of this text is a report element. More... | |
void | zoomToLinkedElement () |
DynamicElementTextItem::zoomToLinkedElement If the parent element is a folio report or a slave element, and is linked, zoom to the linked element. More... | |
Private Attributes | |
QPointer< Element > | m_parent_element |
QPointer< Element > | m_master_element |
QPointer< Element > | m_other_report |
QPointer< Conductor > | m_watched_conductor |
QString | m_text |
QString | m_info_name |
QString | m_composite_text |
QString | m_report_formula |
QString | m_F_str |
DynamicElementTextItem::TextFrom | m_text_from = UserText |
QUuid | m_uuid |
QMetaObject::Connection | m_report_formula_con |
QList< QMetaObject::Connection > | m_formula_connection |
QList< QMetaObject::Connection > | m_update_slave_Xref_connection |
QColor | m_user_color |
bool | m_frame = false |
bool | m_first_scene_change = true |
CrossRefItem * | m_Xref_item = nullptr |
QGraphicsTextItem * | m_slave_Xref_item = nullptr |
qreal | m_text_width = -1 |
QPointF | m_initial_position |
Friends | |
class | DynamicTextItemDelegate |
class | CompositeTextEditDialog |
class | Element |
Additional Inherited Members | |
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 |
QString | m_previous_html_text |
QString | m_previous_text |
QPointF | m_mouse_to_origin_movement |
The DynamicElementTextItem class This class provide a simple text field of element who can be added or removed directly from the diagram editor. This text is created to compensate a big lack of the ElementTextItem : ElementTextItem can't be added or removed directly in the diagram editor.
DynamicElementTextItem::DynamicElementTextItem | ( | Element * | parent_element | ) |
DynamicElementTextItem::DynamicElementTextItem Constructor.
parent_element |
|
override |
|
private |
|
private |
|
private |
QString DynamicElementTextItem::compositeText | ( | ) | const |
|
signal |
|
private |
DynamicElementTextItem::conductorPropertiesChanged This function is only used when the parent element of this text is a report element.
|
private |
DynamicElementTextItem::conductorWasAdded Function only use when parent element is a folio report.
conductor |
|
private |
DynamicElementTextItem::conductorWasRemoved Function only use when parent element is a folio report.
conductor |
|
private |
Element * DynamicElementTextItem::elementUseForInfo | ( | ) | const |
DynamicElementTextItem::elementUseForInfo.
bool DynamicElementTextItem::frame | ( | ) | const |
|
signal |
|
overridevirtual |
DynamicElementTextItem::fromXml Import this text from xml.
dom_elmt |
Implements DiagramTextItem.
|
overrideprotected |
DynamicElementTextItem::hoverEnterEvent If the parent element of this text is a folio report or a slave element, the element is linked and the text display the variable "label" we set the text blue for signal the user that the text act like a link when we double click on.
event |
|
overrideprotected |
QString DynamicElementTextItem::infoName | ( | ) | const |
DynamicElementTextItem::infoName.
|
signal |
|
overrideprotected |
|
private |
DynamicElementTextItem::masterChanged This function is only use when the parent element is a slave. Call when the master element linked to the parent slave element of this text change.
|
overrideprotected |
DynamicElementTextItem::mouseDoubleClickEvent Reimplemented functions, for add extra feature when this text is owned by a slave. In this case if the parent slave element is linked to a master, and this text display the label of the master (both if the 'text from' is 'element info' or 'composite text') the QGraphicsView go to master and select it.
event |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
DynamicElementTextItem::mouseReleaseEvent.
event |
|
overrideprotected |
Element * DynamicElementTextItem::parentElement | ( | ) | const |
DynamicElementTextItem::ParentElement.
ElementTextItemGroup * DynamicElementTextItem::parentGroup | ( | ) | const |
DynamicElementTextItem::parentGroup.
|
signal |
void DynamicElementTextItem::refreshLabelConnection | ( | ) |
DynamicElementTextItem::refreshLabelConnection Refresh the connection of this text when the source of text is label, or composite text, with a variable %{label}.
|
private |
|
private |
DynamicElementTextItem::reportChanged This function is only use when parent element of this text is a folio report The linked report of the parent element was changed.
|
private |
DynamicElementTextItem::reportFormulaChanged The report formula use in the project was changed.
|
private |
DynamicElementTextItem::reportReplacedCompositeText This function is only used when the parent element of this text is a report element.
|
overrideprotected |
void DynamicElementTextItem::setCompositeText | ( | const QString & | text | ) |
DynamicElementTextItem::setCompositeText Set the composite text of this text item to text.
text |
|
private |
void DynamicElementTextItem::setFrame | ( | const bool | frame | ) |
void DynamicElementTextItem::setInfoName | ( | const QString & | info_name | ) |
DynamicElementTextItem::setInfoName Set the information name of the parent element.
info_name |
void DynamicElementTextItem::setPlainText | ( | const QString & | text | ) |
|
private |
DynamicElementTextItem::setPotentialConductor This function is only used when the parent element of this text is a report element Get a conductor in the potential of the parent report.
void DynamicElementTextItem::setText | ( | const QString & | text | ) |
DynamicElementTextItem::setText Set the text of this text.
text |
void DynamicElementTextItem::setTextFrom | ( | DynamicElementTextItem::TextFrom | text_from | ) |
DynamicElementTextItem::setTextFrom Set the final text is created from.
text_from |
void DynamicElementTextItem::setTextWidth | ( | qreal | width | ) |
|
private |
DynamicElementTextItem::setupFormulaConnection Setup the required connection for the formula of the label.
void DynamicElementTextItem::setXref_item | ( | Qt::AlignmentFlag | m_exHrefPos | ) |
QString DynamicElementTextItem::text | ( | ) | const |
|
signal |
DynamicElementTextItem::TextFrom DynamicElementTextItem::textFrom | ( | ) | const |
DynamicElementTextItem::textFrom.
|
signal |
|
static |
DynamicElementTextItem::textFromMetaEnum.
|
signal |
|
overridevirtual |
DynamicElementTextItem::toXml Export this text to xml.
dom_doc |
Reimplemented from DiagramTextItem.
|
inlineoverride |
|
private |
DynamicElementTextItem::updateLabel Update the displayed text, when this dynamic text is based on the label of the parent element. This function is notably use when the label itself is based from a formula. If this dynamic text isn't based on label, this function do nothing.
|
private |
|
private |
DynamicElementTextItem::updateReportText This function is only use when this text is owned by a report, and this text have for info the Label.
void DynamicElementTextItem::updateXref | ( | ) |
DynamicElementTextItem::updateXref Create or delete the Xref according to the current properties of the project.
QUuid DynamicElementTextItem::uuid | ( | ) | const |
|
inlinestatic |
|
private |
DynamicElementTextItem::zoomToLinkedElement If the parent element is a folio report or a slave element, and is linked, zoom to the linked element.
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |