Gestion des champs de textes editables dans l'editeur

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@99 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-08-18 04:42:39 +00:00
parent 900439c00e
commit 92a43deb78
9 changed files with 295 additions and 12 deletions

View File

@@ -6,6 +6,7 @@
#include "partpolygon.h"
#include "partterminal.h"
#include "parttext.h"
#include "parttextfield.h"
#include "partarc.h"
#define GRILLE_X 10
#define GRILLE_Y 10
@@ -155,6 +156,7 @@ void EditorScene::mousePressEvent(QGraphicsSceneMouseEvent *e) {
void EditorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
PartTerminal *terminal;
PartText *text;
PartTextField *textfield;
if (behavior != Polygon && current_polygon != NULL) current_polygon = NULL;
if (e -> button() & Qt::LeftButton) {
switch(behavior) {
@@ -180,6 +182,10 @@ void EditorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
text = new PartText(0, this);
text -> setPos(e -> scenePos());
break;
case TextField:
textfield = new PartTextField(0, this);
textfield -> setPos(e -> scenePos());
break;
default:
QGraphicsScene::mouseReleaseEvent(e);
}
@@ -343,13 +349,14 @@ void EditorScene::fromXml(const QDomDocument &xml_document) {
QDomElement qde = n.toElement();
if (qde.isNull()) continue;
CustomElementPart *cep;
if (qde.tagName() == "line") cep = new PartLine (0, this);
else if (qde.tagName() == "ellipse") cep = new PartEllipse (0, this);
else if (qde.tagName() == "circle") cep = new PartCircle (0, this);
else if (qde.tagName() == "polygon") cep = new PartPolygon (0, this);
else if (qde.tagName() == "terminal") cep = new PartTerminal(0, this);
else if (qde.tagName() == "text") cep = new PartText (0, this);
else if (qde.tagName() == "arc") cep = new PartArc (0, this);
if (qde.tagName() == "line") cep = new PartLine (0, this);
else if (qde.tagName() == "ellipse") cep = new PartEllipse (0, this);
else if (qde.tagName() == "circle") cep = new PartCircle (0, this);
else if (qde.tagName() == "polygon") cep = new PartPolygon (0, this);
else if (qde.tagName() == "terminal") cep = new PartTerminal (0, this);
else if (qde.tagName() == "text") cep = new PartText (0, this);
else if (qde.tagName() == "input") cep = new PartTextField(0, this);
else if (qde.tagName() == "arc") cep = new PartArc (0, this);
else continue;
if (QGraphicsItem *qgi = dynamic_cast<QGraphicsItem *>(cep)) qgi -> setZValue(z++);
cep -> fromXml(qde);