Possibilite d'ajouter des champs de texte editables aux elements

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@66 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-02-24 00:26:04 +00:00
parent 73a78a4628
commit d9176b5cbf
6 changed files with 102 additions and 4 deletions

27
elementtextitem.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "elementtextitem.h"
ElementTextItem::ElementTextItem(QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsTextItem(parent, scene) {
follow_parent_rotations = false;
setTextInteractionFlags(Qt::TextEditorInteraction);
}
ElementTextItem::ElementTextItem(const QString &text, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsTextItem(text, parent, scene) {
follow_parent_rotations = false;
setTextInteractionFlags(Qt::TextEditorInteraction);
}
void ElementTextItem::setPos(const QPointF &pos) {
QPointF actual_pos = pos;
actual_pos -= QPointF(0.0, boundingRect().height() / 2.0);
QGraphicsItem::setPos(actual_pos);
}
void ElementTextItem::setPos(qreal x, qreal y) {
setPos(QPointF(x, y));
}
QPointF ElementTextItem::pos() const {
QPointF actual_pos = pos();
actual_pos += QPointF(0.0, boundingRect().height() / 2.0);
return(actual_pos);
}