diff --git a/sources/customelement.cpp b/sources/customelement.cpp index c1d9fd204..a292fbf72 100644 --- a/sources/customelement.cpp +++ b/sources/customelement.cpp @@ -698,7 +698,8 @@ bool CustomElement::validOrientationAttribute(const QDomElement &e) { l'element XML e au QPainter qp Les styles possibles sont : - line-style : style du trait - - dashed : trait en pointilles + - dashed : trait en pointilles (tirets) + - dotted : trait en pointilles (points) - normal : trait plein [par defaut] - line-weight : epaiseur du trait - thin : trait fin @@ -739,6 +740,7 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) { QString style_value = rx.cap(2); if (style_name == "line-style") { if (style_value == "dashed") pen.setStyle(Qt::DashLine); + else if (style_value == "dotted") pen.setStyle(Qt::DotLine); else if (style_value == "normal") pen.setStyle(Qt::SolidLine); } else if (style_name == "line-weight") { if (style_value == "thin") pen.setWidth(0); diff --git a/sources/editor/customelementgraphicpart.cpp b/sources/editor/customelementgraphicpart.cpp index f912b4e1a..ce23fe754 100644 --- a/sources/editor/customelementgraphicpart.cpp +++ b/sources/editor/customelementgraphicpart.cpp @@ -27,6 +27,7 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const { css_like_styles += "line-style:"; if (_linestyle == DashedStyle) css_like_styles += "dashed"; + if (_linestyle == DottedStyle) css_like_styles += "dotted"; else if (_linestyle == NormalStyle) css_like_styles += "normal"; css_like_styles += ";line-weight:"; @@ -65,6 +66,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde) { QString style_value = rx.cap(2); if (style_name == "line-style") { if (style_value == "dashed") _linestyle = DashedStyle; + if (style_value == "dotted") _linestyle = DottedStyle; else if (style_value == "normal") _linestyle = NormalStyle; // il n'y a pas de else car les valeurs non conformes sont ignorees (idem par la suite) } else if (style_name == "line-weight") { @@ -107,6 +109,7 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const { // applique le style de trait if (_linestyle == DashedStyle) pen.setStyle(Qt::DashLine); + if (_linestyle == DottedStyle) pen.setStyle(Qt::DotLine); else if (_linestyle == NormalStyle) pen.setStyle(Qt::SolidLine); // applique l'epaisseur de trait diff --git a/sources/editor/customelementgraphicpart.h b/sources/editor/customelementgraphicpart.h index 7935bb988..1147b04ff 100644 --- a/sources/editor/customelementgraphicpart.h +++ b/sources/editor/customelementgraphicpart.h @@ -32,7 +32,8 @@ class CustomElementGraphicPart : public CustomElementPart { /// Qualifie le style de ligne utilise pour dessiner la partie enum LineStyle { NormalStyle, ///< Ligne pleine - DashedStyle ///< Ligne pointillee + DashedStyle, ///< Ligne pointillee (tirets) + DottedStyle ///< Ligne pointillee (points) }; /// Qualifie l'epaisseur de ligne utilisee pour dessiner la partie diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 9d0fc9501..87c4e91f8 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -35,8 +35,9 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, // style style = new QButtonGroup(this); - style -> addButton(normal_style = new QRadioButton(tr("Normal", "element part line style")), CustomElementGraphicPart::NormalStyle); - style -> addButton(dashed_style = new QRadioButton(tr("Pointill\351", "element part line style")), CustomElementGraphicPart::DashedStyle); + style -> addButton(normal_style = new QRadioButton(tr("Normal", "element part line style")), CustomElementGraphicPart::NormalStyle); + style -> addButton(dashed_style = new QRadioButton(tr("Tiret", "element part line style")), CustomElementGraphicPart::DashedStyle); + style -> addButton(dotted_style = new QRadioButton(tr("Pointill\351", "element part line style")), CustomElementGraphicPart::DottedStyle); normal_style -> setChecked(true); // epaisseur @@ -72,6 +73,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, style_layout -> addWidget(new QLabel(tr("Style : "))); style_layout -> addWidget(normal_style); style_layout -> addWidget(dashed_style); + style_layout -> addWidget(dotted_style); style_layout -> addStretch(); main_layout -> addItem(style_layout); diff --git a/sources/editor/styleeditor.h b/sources/editor/styleeditor.h index 2968de572..2f10b9988 100644 --- a/sources/editor/styleeditor.h +++ b/sources/editor/styleeditor.h @@ -41,7 +41,7 @@ class StyleEditor : public ElementItemEditor { CustomElementGraphicPart *part; QVBoxLayout *main_layout; QButtonGroup *color, *style, *weight, *filling; - QRadioButton *black_color, *white_color, *normal_style, *dashed_style; + QRadioButton *black_color, *white_color, *normal_style, *dashed_style, *dotted_style; QRadioButton *none_weight, *thin_weight, *normal_weight, *no_filling; QRadioButton *black_filling, *white_filling; QCheckBox *antialiasing;