1 #include "association.h"
6 :
Entite(mum,nom,x,y, parent, laScene,listeChamps,isAssoc)
8 qDebug()<<
"Association::Association(MainWindow* mum,QString nom,qreal x,qreal y, QGraphicsItem* parent, QCustomGraphicsScene * laScene, QStringList listeChamps)";
9 QGraphicsRectItem::setFlags(
10 QGraphicsItem::ItemIsFocusable
11 | QGraphicsItem::ItemIsMovable
12 | QGraphicsItem::ItemIsSelectable
13 |QGraphicsItem::ItemClipsChildrenToShape);
15 m_radius_y=m_radius_x;
23 qDebug()<<
"void Association::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)";
24 painter->setRenderHint(QPainter::Antialiasing,
true);
25 if (QGraphicsRectItem::isSelected())
28 pen.setStyle(Qt::DashLine);
33 int hauteur=
title->boundingRect().height();
39 leRect.setHeight(hauteur);
42 painter->drawRoundedRect(this->rect(),m_radius_x,m_radius_y);
44 QLinearGradient gradient(rect().topLeft(), rect().bottomRight());
45 gradient.setColorAt(0, QColor(
"#FFD4A3"));
46 gradient.setColorAt(1, Qt::white);
50 QPainterPath roundRectPath;
62 float largeur,left,top;
63 largeur=rect().width();
64 hauteur=rect().height();
69 roundRectPath.moveTo(largeur, top+rayon);
70 roundRectPath.arcTo(largeur-2*rayon, top, 2*rayon, 2*rayon, 0.0, 90.0);
71 roundRectPath.lineTo(left+rayon, top);
72 roundRectPath.arcTo(left, top, 2*rayon, 2*rayon, 90.0, 90.0);
73 roundRectPath.lineTo(top, hauteur-rayon);
74 roundRectPath.arcTo(left, hauteur-2*rayon, 2*rayon, 2*rayon, 180.0, 90.0);
75 roundRectPath.lineTo(largeur-rayon, hauteur);
76 roundRectPath.arcTo(largeur-2*rayon, hauteur-2*rayon, 2*rayon, 2*rayon, 270.0, 90.0);
77 roundRectPath.closeSubpath();
81 float y=
title->boundingRect().height();
82 roundRectPath.moveTo(0,y);
83 roundRectPath.lineTo(rect().width(),y);
87 painter->setBrush(gradient);
88 painter->drawPath(roundRectPath);
101 QVector <Entite*> resultat;
105 resultat.append(leLien->
t1);
Entite * t2
t2 second object
The QCustomGraphicsScene class This class is designed to deal with mouse events.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
paint association
void setRoundedRect(const QRectF rect, const double radius_x, const double radius_y)
Set the rounded rect.
The Lien class a link is betwwen to objects it contains a line a role text cardinality ...
QVector< Entite * > vectEntitesAssociees()
vectEntitesAssociees
Entite * t1
t1 first object
QVector< Lien * > vectLiens
vectLiens this vector contains adresses of the links concerning entity
void setRadiusY(const double radius_y)
Set the rounded rect corner y radius.
QString typeDeJointure
typeDeJointure cif –1,1–CIF–0,n–> df –0,1–DF–0,n–>or leg --------—
QVector< Property * > vecteurChamps
vecteurChamps container for entity's fields
Association(MainWindow *mum, QString nom, qreal x, qreal y, QGraphicsItem *parent, QCustomGraphicsScene *laScene, QStringList listeChamps, bool isAssoc)
Association.
void setRadiusX(const double radius_x)
Set the rounded rect corner x radius.
The Entite class Entity is an object we have to deal with.
QGraphicsTextItem * title
title
The MainWindow class main code of application.
QGraphicsRectItem * rectTitle
rectTitle rectangle wich contains title