clean some code

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5279 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-03-25 18:42:18 +00:00
parent d44ead205b
commit 37ef43b97b
6 changed files with 11 additions and 47 deletions

View File

@@ -1278,8 +1278,8 @@ void Conductor::calculateTextItemPosition() {
QPointF text_pos = posForText(rotation);
if (!m_text_item -> wasRotateByUser()) {
rotation == Qt::Vertical ? m_text_item -> setRotationAngle(m_properties.verti_rotate_text):
m_text_item -> setRotationAngle(m_properties.horiz_rotate_text);
rotation == Qt::Vertical ? m_text_item -> setRotation(m_properties.verti_rotate_text):
m_text_item -> setRotation(m_properties.horiz_rotate_text);
}
//Adjust the position of text if his rotation

View File

@@ -26,8 +26,7 @@
* @param parent : parent item
*/
DiagramTextItem::DiagramTextItem(QGraphicsItem *parent) :
QGraphicsTextItem(parent),
m_rotation_angle(0.0)
QGraphicsTextItem(parent)
{ build(); }
/**
@@ -38,8 +37,7 @@ DiagramTextItem::DiagramTextItem(QGraphicsItem *parent) :
DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent) :
QGraphicsTextItem(text, parent),
m_mouse_hover(false),
m_previous_html_text(text),
m_rotation_angle(0.0)
m_previous_html_text(text)
{ build(); }
/**
@@ -76,37 +74,6 @@ QDomElement DiagramTextItem::toXml(QDomDocument &) const {
return QDomElement();
}
/**
@return l'angle de rotation actuel de ce texte
*/
qreal DiagramTextItem::rotationAngle() const {
return(m_rotation_angle);
}
/**
Permet de tourner le texte a un angle donne de maniere absolue.
Un angle de 0 degres correspond a un texte horizontal non retourne.
@param rotation Nouvel angle de rotation de ce texte
@see applyRotation
*/
void DiagramTextItem::setRotationAngle(const qreal &rotation) {
qreal applied_rotation = QET::correctAngle(rotation);
applyRotation(applied_rotation - m_rotation_angle);
m_rotation_angle = applied_rotation;
}
/**
Permet de tourner le texte de maniere relative.
L'angle added_rotation est ajoute a l'orientation actuelle du texte.
@param added_rotation Angle a ajouter a la rotation actuelle
@see applyRotation
*/
void DiagramTextItem::rotateBy(const qreal &added_rotation) {
qreal applied_added_rotation = QET::correctAngle(added_rotation);
m_rotation_angle = QET::correctAngle(m_rotation_angle + applied_added_rotation);
applyRotation(applied_added_rotation);
}
/**
Traduit en coordonnees de la scene un mouvement / vecteur initialement
exprime en coordonnees locales.

View File

@@ -54,9 +54,6 @@ class DiagramTextItem : public QGraphicsTextItem
Diagram *diagram() const;
virtual void fromXml(const QDomElement &) = 0;
virtual QDomElement toXml(QDomDocument &) const;
qreal rotationAngle() const;
void setRotationAngle(const qreal &);
void rotateBy(const qreal &);
void edit();
QPointF mapMovementToScene (const QPointF &) const;
@@ -100,7 +97,6 @@ class DiagramTextItem : public QGraphicsTextItem
QString m_previous_html_text,
m_previous_text;
qreal m_rotation_angle;
QPointF m_mouse_to_origin_movement;
};
#endif

View File

@@ -49,7 +49,7 @@ IndependentTextItem::~IndependentTextItem() {
void IndependentTextItem::fromXml(const QDomElement &e) {
setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
setHtml(e.attribute("text"));
setRotationAngle(e.attribute("rotation").toDouble());
setRotation(e.attribute("rotation").toDouble());
}
/**