2007-02-24 00:26:04 +00:00
|
|
|
#ifndef ELEMENT_TEXT_ITEM_H
|
2007-04-09 02:56:47 +00:00
|
|
|
#define ELEMENT_TEXT_ITEM_H
|
|
|
|
#include <QGraphicsTextItem>
|
|
|
|
#include <QtXml>
|
|
|
|
/**
|
|
|
|
Cette classe represente un element de texte editable.
|
|
|
|
Il est possible pour ce champ de texte de rester dans le sens de la lecture
|
|
|
|
malgre les rotations de son element parent.
|
|
|
|
*/
|
|
|
|
class ElementTextItem : public QGraphicsTextItem {
|
2007-04-12 03:13:13 +00:00
|
|
|
// constructeurs, destructeur
|
2007-04-09 02:56:47 +00:00
|
|
|
public:
|
|
|
|
ElementTextItem(QGraphicsItem * = 0, QGraphicsScene * = 0);
|
|
|
|
ElementTextItem(const QString &, QGraphicsItem * = 0, QGraphicsScene * = 0);
|
2007-04-12 03:13:13 +00:00
|
|
|
virtual ~ElementTextItem();
|
2007-04-09 02:56:47 +00:00
|
|
|
|
|
|
|
// attributs
|
2007-04-12 03:13:13 +00:00
|
|
|
public:
|
|
|
|
enum { Type = UserType + 1003 };
|
|
|
|
|
2007-04-09 02:56:47 +00:00
|
|
|
private:
|
|
|
|
bool follow_parent_rotations;
|
|
|
|
|
|
|
|
// methodes
|
|
|
|
public:
|
|
|
|
virtual int type() const { return Type; }
|
|
|
|
bool followParentRotations() const;
|
|
|
|
void setFollowParentRotations(bool);
|
2007-04-12 03:13:13 +00:00
|
|
|
void fromXml(const QDomElement &);
|
|
|
|
QDomElement toXml(QDomDocument &) const;
|
2007-04-09 02:56:47 +00:00
|
|
|
void setPos(const QPointF &);
|
|
|
|
void setPos(qreal, qreal);
|
|
|
|
QPointF pos() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Permet de savoir si le champ de texte suit les rotations de son parent.
|
|
|
|
@return true si le champ de texte suit les rotations de son parent, false
|
|
|
|
sinon
|
|
|
|
*/
|
|
|
|
inline bool ElementTextItem::followParentRotations() const {
|
|
|
|
return(follow_parent_rotations);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Permet de specifier si le champ de texte suit les rotations de son parent.
|
|
|
|
@param frp true si le champ de texte doit suivre les rotations de son
|
|
|
|
parent, false pour qu'ils ne les suivent pas
|
|
|
|
*/
|
|
|
|
inline void ElementTextItem::setFollowParentRotations(bool frp) {
|
|
|
|
follow_parent_rotations = frp;
|
|
|
|
}
|
|
|
|
|
2007-02-24 00:26:04 +00:00
|
|
|
#endif
|