Add basic color line in symbol editor

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2187 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2013-05-31 13:30:50 +00:00
parent e66e62c46b
commit 4b969c2323
5 changed files with 31 additions and 4 deletions

View File

@@ -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);
}
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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;