gapMea  1.0-rc1-1.5.3.2
GapMea est un outil visuel écrit en c++ à l'aide de la bibliothèque QT qui sert de base entre autre à l'environnement graphique de KDE.Il permet de dessiner des schémas recueillant et structurant les informations nécessaires à un domaine de gestion. Le schéma obtenu est enregistré dans un fichier texte au format xml.
 All Classes Functions Variables
property.cpp
1 #include "property.h"
2 #include <QMenu>
3 #include <QAction>
4 #include <QGraphicsSceneMouseEvent>
5 #include <QGraphicsLineItem>
6 #include <QDebug>
7 #include <QTextDocument>
8 #include "ui_mainwindow.h"
9 
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)
12 {
13  qDebug()<<"constructeur de Property";
14  maman=mum;
15  lEntite=(Entite*)pParent;
16  setAcceptDrops(true);
17  //setFlag(QGraphicsItem::ItemIsSelectable,true);
18  connect(this,SIGNAL(jeSuisSelectionne(Property*)),maman,SLOT(selectionne(Property*)));
19 
20 }
21 Property::~Property()
22 {
23  qDebug()<<"Property::~Property()";
24  //le champ s'enlève du vecteur ou il est stocké
25  if(lEntite!=NULL)
26  {
27  int index=lEntite->vecteurChamps.indexOf(this);
28  if(index!=-1)
29  {
30  lEntite->vecteurChamps.remove(index,1);
31  }
32  }
33  //lEntite->redraw();
34 }
35 void Property::contextMenuEvent(QGraphicsSceneMouseEvent *event)
36 {
37  //ce qui se passe lorsque le menu contextuel du champ est appelé
38  qDebug()<<"void Property::contextMenuEvent(QGraphicsSceneMouseEvent *event)";
39  //sélection de l'objet
40  setSelected(true);
41  maman->selectionne(lEntite);
42 
43  //création du menu cntextuel du champ
44  QMenu menu(QObject::tr("Property's Menu"));
45  //titre du menu contextuel
46  QAction* titre=new QAction(menu.title(),this);
47  titre->setDisabled(true);
48  menu.addAction(titre);
49  titre->setFont(QFont("verdana",9,3,true));
50  //si je n'était pas sélectionné, je le deviens
51  this->setSelected(!this->isSelected());
52  //création des actions du menu
53  QAction *removeAction ;
54  removeAction = menu.addAction(tr("&Remove"));
55 
56  QAction *editAction = menu.addAction(QIcon(":/mini-eye.xpm"),tr("&Edit"));
57  //affichage conditionnel du menu concernant les conditions
58 
59 
60  //exécution du menu
61  QAction* actionChoisie=menu.exec(event->screenPos());
62  if(actionChoisie!=NULL)
63  {
64  if(actionChoisie==removeAction)
65  {
66 
67  //si c'est un champ d'une table redimensionnement
68  deleteLater();
69  // emit jAiChange();
70  }
71  //qlq chose a été fait
72  else {
73  if(actionChoisie==editAction)
74  {
75  maman->editProperty(this);
76  }
77  }
78 
79 
80  }//fi du si qlq chose a ete fait
81 }
82 void Property::dropEvent( QGraphicsSceneDragDropEvent* event)
83 {
84  qDebug()<<"void Property::dropEvent(QDropEvent *event)";
85 }
86 void Property::dragEnterEvent( QGraphicsSceneDragDropEvent* event)
87 {
88  qDebug()<<"void Property::dragEnterEvent(QDragEnterEvent *event)";
89  event->accept();
90 }
91 void Property::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
92 {
93  qDebug()<<"void Property::dragMoveEvent(QGraphicsSceneDragDropEvent *event)";
94  event->accept();
95 }
96 
97 QString Property::toSql()
98 {
99  QString motReserve="#ad2bee";
100  QString typeChamp="#87711d";
101  QString nomTable="#29a329";
102  QString nomChamp="#39b339";
103  QString tailleChamp="#97812d";
104  QString resultat;
105  resultat="<font color=\""+nomChamp+"\">"+this->nom+"</font> <font color=\""+typeChamp+"\">"+this->sonType+"</font>";
106  if(!taille.isEmpty())
107  {
108  resultat+="(<font color=\""+tailleChamp+"\">"+taille+"</font>)";
109  }
110  return(resultat);
111 }
112 
QString toSql()
toSql
Definition: property.cpp:97
QString sonType
sonType his type ex varchar(25) ou integer
Definition: property.h:64
Entite * lEntite
lEntite object wich contains it
Definition: property.h:58
QVector< Property * > vecteurChamps
vecteurChamps container for entity's fields
Definition: entite.h:74
QString taille
taille whenever field type need size
Definition: property.h:75
The Property class property is a field it can be placed into entity or relation.
Definition: field.h:13
QString nom
nom his name example weight
Definition: property.h:50
The Entite class Entity is an object we have to deal with.
Definition: entite.h:20
The MainWindow class main code of application.
Definition: mainwindow.h:20