mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 08:40:53 +01:00
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:
27
elementtextitem.cpp
Normal file
27
elementtextitem.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user