mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-25 16:59:58 +01:00
Dynamic element text item new feature
Add feature keep visual rotation. When parent is rotated, the text rotation is changed to keep the same visual rotation.
This commit is contained in:
@@ -49,6 +49,7 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
Q_PROPERTY(QString compositeText READ compositeText WRITE setCompositeText NOTIFY compositeTextChanged)
|
||||
Q_PROPERTY(bool frame READ frame WRITE setFrame NOTIFY frameChanged)
|
||||
Q_PROPERTY(qreal textWidth READ textWidth WRITE setTextWidth NOTIFY textWidthChanged)
|
||||
Q_PROPERTY(bool keepVisualRotation READ keepVisualRotation WRITE setKeepVisualRotation NOTIFY keepVisualRotationChanged)
|
||||
|
||||
public:
|
||||
|
||||
@@ -69,6 +70,7 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
void frameChanged(bool frame);
|
||||
void plainTextChanged();
|
||||
void textWidthChanged(qreal width);
|
||||
void keepVisualRotationChanged(bool keep);
|
||||
|
||||
public:
|
||||
DynamicElementTextItem(Element *parent_element);
|
||||
@@ -104,6 +106,9 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
void setTextWidth(qreal width);
|
||||
void setXref_item(Qt::AlignmentFlag m_exHrefPos);
|
||||
|
||||
void setKeepVisualRotation(bool set);
|
||||
bool keepVisualRotation() const;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
@@ -133,6 +138,8 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
void conductorPropertiesChanged();
|
||||
QString reportReplacedCompositeText() const;
|
||||
void zoomToLinkedElement();
|
||||
void parentElementRotationChanged();
|
||||
void thisRotationChanged();
|
||||
|
||||
private:
|
||||
QPointer <Element>
|
||||
@@ -160,6 +167,8 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
QGraphicsTextItem *m_slave_Xref_item = nullptr;
|
||||
qreal m_text_width = -1;
|
||||
QPointF m_initial_position;
|
||||
bool m_keep_visual_rotation = true;
|
||||
qreal m_visual_rotation_ref = 0;
|
||||
};
|
||||
|
||||
#endif // DYNAMICELEMENTTEXTITEM_H
|
||||
|
||||
Reference in New Issue
Block a user