C'est déjà disponible dans l’éditeur d’élément pour la primitive "trait", ou tu peux choisir différents embouts de début ou de fin.
Il faut adapter ce code pour les conducteurs pour dessiner ton embout, switch sur avec ou sans embout, le sauvegarder dans le XML, et savoir lire ensuite si ce conducteur possède une terminaison ou pas, et si oui de quel coté, les deux? ..
//Draw the first extremity
QPointF start_point;
if (draw_1st_end)
{
QList<QPointF> four_points1(fourEndPoints(point1, point2, length1));
if (first_end == Qet::Circle)
{
path.addEllipse(QRectF(four_points1[0] - QPointF(length1, length1), QSizeF(length1 * 2.0, length1 * 2.0)));
start_point = four_points1[1];
}
else if (first_end == Qet::Diamond)
{
path.addPolygon(QPolygonF() << four_points1[1] << four_points1[2] << point1 << four_points1[3] << four_points1[1]);
start_point = four_points1[1];
}
else if (first_end == Qet::Simple)
{
path.addPolygon(QPolygonF() << four_points1[3] << point1 << four_points1[2]);
start_point = point1;
}
else if (first_end == Qet::Triangle)
{
path.addPolygon(QPolygonF() << four_points1[0] << four_points1[2] << point1 << four_points1[3] << four_points1[0]);
start_point = four_points1[0];
}
//Adjust the start point according to the pen width
if (pen_width && (first_end == Qet::Simple || first_end == Qet::Circle))
start_point = QLineF(start_point, point2).pointAt(pen_width / 2.0 / line_length);
}
else
{
start_point = point1;
}
"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !