diff --git a/sources/customelement.cpp b/sources/customelement.cpp index 2c5154ea3..cdcefb09e 100644 --- a/sources/customelement.cpp +++ b/sources/customelement.cpp @@ -737,6 +737,9 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) { pen.setJoinStyle(Qt::BevelJoin); pen.setCapStyle(Qt::SquareCap); pen.setColor(Qt::black); + pen.setColor(Qt::red); + pen.setColor(Qt::blue); + pen.setColor(Qt::green); pen.setStyle(Qt::SolidLine); pen.setWidthF(1.0); brush.setStyle(Qt::NoBrush); @@ -782,6 +785,12 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) { pen.setColor(QColor(0, 0, 0, pen.color().alpha())); } else if (style_value == "white") { pen.setColor(QColor(255, 255, 255, pen.color().alpha())); + } else if (style_value == "red") { + pen.setColor(Qt::red); + }else if (style_value == "blue") { + pen.setColor(Qt::blue); + }else if (style_value == "green") { + pen.setColor(Qt::green); } } } diff --git a/sources/editor/customelementgraphicpart.cpp b/sources/editor/customelementgraphicpart.cpp index c704c88a5..00373cfcc 100644 --- a/sources/editor/customelementgraphicpart.cpp +++ b/sources/editor/customelementgraphicpart.cpp @@ -47,6 +47,9 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const { css_like_styles += ";color:"; if (_color == WhiteColor) css_like_styles += "white"; else if (_color == BlackColor) css_like_styles += "black"; + else if (_color == GreenColor) css_like_styles += "black"; + else if (_color == RedColor) css_like_styles += "black"; + else if (_color == BlueColor) css_like_styles += "black"; qde.setAttribute("style", css_like_styles); qde.setAttribute("antialias", _antialiased ? "true" : "false"); @@ -80,13 +83,16 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde) { } else if (style_name == "filling") { if (style_value == "white") _filling = WhiteFilling; else if (style_value == "black") _filling = BlackFilling; - else if (style_value == "red") _filling = RedFilling; + else if (style_value == "red") _filling = RedFilling; else if (style_value == "green") _filling = GreenFilling; - else if (style_value == "blue") _filling = BlueFilling; + else if (style_value == "blue") _filling = BlueFilling; else if (style_value == "none") _filling = NoneFilling; } else if (style_name == "color") { if (style_value == "black") _color = BlackColor; else if (style_value == "white") _color = WhiteColor; + else if (style_value == "green") _color = GreenColor; + else if (style_value == "red") _color = RedColor; + else if (style_value == "blue") _color = BlueColor; } } @@ -147,6 +153,9 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const { // applique la couleur de trait if (_color == WhiteColor) pen.setColor(QColor(255, 255, 255, pen.color().alpha())); else if (_color == BlackColor) pen.setColor(QColor( 0, 0, 0, pen.color().alpha())); + else if (_color == GreenColor) pen.setColor(QColor(Qt::green)); + else if (_color == RedColor) pen.setColor(QColor(Qt::red)); + else if (_color == BlueColor) pen.setColor(QColor(Qt::blue)); // applique l'antialiasing diff --git a/sources/editor/customelementgraphicpart.h b/sources/editor/customelementgraphicpart.h index eb31be1d9..ea0c23a92 100644 --- a/sources/editor/customelementgraphicpart.h +++ b/sources/editor/customelementgraphicpart.h @@ -55,7 +55,10 @@ class CustomElementGraphicPart : public CustomElementPart { /// This enum lists the various line colors available to draw primitives. enum Color { BlackColor, ///< Black line - WhiteColor ///< White line + WhiteColor, ///< White line + GreenColor, ///< Green line + RedColor, ///< Red line + BlueColor ///< Blue line }; // constructors, destructor diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index a35ea7fce..3ae35f9b7 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -32,6 +32,9 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, color = new QButtonGroup(this); color -> addButton(black_color = new QRadioButton(tr("Noir", "element part color")), CustomElementGraphicPart::BlackColor); color -> addButton(white_color = new QRadioButton(tr("Blanc", "element part color")), CustomElementGraphicPart::WhiteColor); + color -> addButton(green_color = new QRadioButton(tr("Vert", "element part color")), CustomElementGraphicPart::GreenColor); + color -> addButton(red_color = new QRadioButton(tr("Rouge", "element part color")), CustomElementGraphicPart::RedColor); + color -> addButton(blue_color = new QRadioButton(tr("Bleu", "element part color")), CustomElementGraphicPart::BlueColor); // style @@ -70,6 +73,9 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, color_layout -> addWidget(new QLabel(tr("Couleur : "))); color_layout -> addWidget(black_color); color_layout -> addWidget(white_color); + color_layout -> addWidget(green_color); + color_layout -> addWidget(red_color); + color_layout -> addWidget(blue_color); color_layout -> addStretch(); main_layout -> addLayout(color_layout); diff --git a/sources/editor/styleeditor.h b/sources/editor/styleeditor.h index 23f52cb89..2eb7d4942 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, *dotted_style; + QRadioButton *black_color, *white_color, *normal_style, *dashed_style, *dotted_style, *green_color, *red_color, *blue_color; QRadioButton *none_weight, *thin_weight, *normal_weight, *no_filling; QRadioButton *black_filling, *white_filling, *green_filling, *red_filling, *blue_filling; QCheckBox *antialiasing;