4 #include <QGraphicsSceneMouseEvent>
5 #include <QGraphicsLineItem>
7 #include <QTextDocument>
8 #include "ui_mainwindow.h"
10 Property::Property(
MainWindow* mum ,
bool isFree,
QGraphicsScene* pScene,QString pName,QString pType, QString pRole,QString pTaille,QGraphicsItem* pParent)
11 :
QGraphicsTextItem(pName,pParent),nom(pName), sonType(pType), role(pRole), taille(pTaille)
13 qDebug()<<
"constructeur de Property";
18 connect(
this,SIGNAL(jeSuisSelectionne(
Property*)),maman,SLOT(selectionne(
Property*)));
23 qDebug()<<
"Property::~Property()";
35 void Property::contextMenuEvent(QGraphicsSceneMouseEvent *event)
38 qDebug()<<
"void Property::contextMenuEvent(QGraphicsSceneMouseEvent *event)";
44 QMenu menu(QObject::tr(
"Property's Menu"));
46 QAction* titre=
new QAction(menu.title(),
this);
47 titre->setDisabled(
true);
48 menu.addAction(titre);
49 titre->setFont(QFont(
"verdana",9,3,
true));
51 this->setSelected(!this->isSelected());
53 QAction *removeAction ;
54 removeAction = menu.addAction(tr(
"&Remove"));
56 QAction *editAction = menu.addAction(QIcon(
":/mini-eye.xpm"),tr(
"&Edit"));
61 QAction* actionChoisie=menu.exec(event->screenPos());
62 if(actionChoisie!=NULL)
64 if(actionChoisie==removeAction)
73 if(actionChoisie==editAction)
75 maman->editProperty(
this);
82 void Property::dropEvent( QGraphicsSceneDragDropEvent* event)
84 qDebug()<<
"void Property::dropEvent(QDropEvent *event)";
86 void Property::dragEnterEvent( QGraphicsSceneDragDropEvent* event)
88 qDebug()<<
"void Property::dragEnterEvent(QDragEnterEvent *event)";
91 void Property::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
93 qDebug()<<
"void Property::dragMoveEvent(QGraphicsSceneDragDropEvent *event)";
99 QString motReserve=
"#ad2bee";
100 QString typeChamp=
"#87711d";
101 QString nomTable=
"#29a329";
102 QString nomChamp=
"#39b339";
103 QString tailleChamp=
"#97812d";
105 resultat=
"<font color=\""+nomChamp+
"\">"+this->
nom+
"</font> <font color=\""+typeChamp+
"\">"+this->
sonType+
"</font>";
108 resultat+=
"(<font color=\""+tailleChamp+
"\">"+
taille+
"</font>)";
QString sonType
sonType his type ex varchar(25) ou integer
Entite * lEntite
lEntite object wich contains it
QVector< Property * > vecteurChamps
vecteurChamps container for entity's fields
QString taille
taille whenever field type need size
The Property class property is a field it can be placed into entity or relation.
QString nom
nom his name example weight
The Entite class Entity is an object we have to deal with.
The MainWindow class main code of application.