mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Add grey color for element part
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3951 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -171,6 +171,7 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const
|
||||
else if (_filling == GreenFilling) css_like_styles += "green";
|
||||
else if (_filling == BlueFilling) css_like_styles += "blue";
|
||||
else if (_filling == RedFilling) css_like_styles += "red";
|
||||
else if (_filling == GrayFilling) css_like_styles += "gray";
|
||||
|
||||
|
||||
css_like_styles += ";color:";
|
||||
@@ -179,7 +180,8 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const
|
||||
else if (_color == GreenColor) css_like_styles += "green";
|
||||
else if (_color == RedColor) css_like_styles += "red";
|
||||
else if (_color == BlueColor) css_like_styles += "blue";
|
||||
|
||||
else if (_color == GrayColor) css_like_styles += "gray";
|
||||
|
||||
qde.setAttribute("style", css_like_styles);
|
||||
qde.setAttribute("antialias", _antialiased ? "true" : "false");
|
||||
}
|
||||
@@ -226,6 +228,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
||||
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 == "gray") _filling = GrayFilling;
|
||||
else if (style_value == "none") _filling = NoneFilling;
|
||||
}
|
||||
else if (style_name == "color")
|
||||
@@ -235,6 +238,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
||||
else if (style_value == "green") _color = GreenColor;
|
||||
else if (style_value == "red") _color = RedColor;
|
||||
else if (style_value == "blue") _color = BlueColor;
|
||||
else if (style_value == "gray") _color = GrayColor;
|
||||
}
|
||||
}
|
||||
//Get antialiasing
|
||||
@@ -290,6 +294,7 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const
|
||||
else if (_filling == GreenFilling) brush.setColor(Qt::green);
|
||||
else if (_filling == RedFilling) brush.setColor(Qt::red);
|
||||
else if (_filling == BlueFilling) brush.setColor(Qt::blue);
|
||||
else if (_filling == GrayFilling) brush.setColor(Qt::gray);
|
||||
}
|
||||
|
||||
//Apply pen color
|
||||
@@ -298,6 +303,7 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const
|
||||
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));
|
||||
else if (_color == GrayColor) pen.setColor(QColor(Qt::gray));
|
||||
|
||||
//Apply antialiasing
|
||||
painter.setRenderHint(QPainter::Antialiasing, _antialiased);
|
||||
|
||||
@@ -56,10 +56,10 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar
|
||||
enum LineWeight {NoneWeight, ThinWeight, NormalWeight, UltraWeight, BigWeight};
|
||||
|
||||
//Filling color of the part : NoneFilling -> No filling (i.e. transparent)
|
||||
enum Filling { NoneFilling, BlackFilling, WhiteFilling, GreenFilling, RedFilling, BlueFilling};
|
||||
enum Filling { NoneFilling, BlackFilling, WhiteFilling, GreenFilling, RedFilling, BlueFilling, GrayFilling};
|
||||
|
||||
//Line color
|
||||
enum Color {BlackColor, WhiteColor, GreenColor, RedColor, BlueColor};
|
||||
enum Color {BlackColor, WhiteColor, GreenColor, RedColor, BlueColor, GrayColor};
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
|
||||
@@ -35,6 +35,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
outline_color -> addItem(tr("Vert", "element part color"), CustomElementGraphicPart::GreenColor);
|
||||
outline_color -> addItem(tr("Rouge", "element part color"), CustomElementGraphicPart::RedColor);
|
||||
outline_color -> addItem(tr("Bleu", "element part color"), CustomElementGraphicPart::BlueColor);
|
||||
outline_color -> addItem(tr("Gris", "element part color"), CustomElementGraphicPart::GrayColor);
|
||||
|
||||
// style
|
||||
line_style = new QComboBox(this);
|
||||
@@ -60,6 +61,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
filling_color -> addItem(tr("Vert", "element part filling"), CustomElementGraphicPart::GreenFilling);
|
||||
filling_color -> addItem(tr("Rouge", "element part filling"), CustomElementGraphicPart::RedFilling);
|
||||
filling_color -> addItem(tr("Bleu", "element part filling"), CustomElementGraphicPart::BlueFilling);
|
||||
filling_color -> addItem(tr("Gris", "element part filling"), CustomElementGraphicPart::GrayFilling);
|
||||
|
||||
// antialiasing
|
||||
antialiasing = new QCheckBox(tr("Antialiasing"));
|
||||
|
||||
@@ -43,9 +43,9 @@ class StyleEditor : public ElementItemEditor
|
||||
QList <CustomElementGraphicPart *> m_part_list;
|
||||
QList <CustomElementPart *> m_cep_list;
|
||||
QVBoxLayout *main_layout;
|
||||
QRadioButton *black_color, *white_color, *normal_style, *dashed_style, *dashdotted_style, *dotted_style, *green_color, *red_color, *blue_color;
|
||||
QRadioButton *black_color, *white_color, *normal_style, *dashed_style, *dashdotted_style, *dotted_style, *green_color, *red_color, *blue_color, *gray_color;
|
||||
QRadioButton *none_weight, *thin_weight, *normal_weight, *no_filling;
|
||||
QRadioButton *black_filling, *white_filling, *green_filling, *red_filling, *blue_filling;
|
||||
QRadioButton *black_filling, *white_filling, *green_filling, *red_filling, *blue_filling, *gray_filling;
|
||||
QCheckBox *antialiasing;
|
||||
QComboBox *filling_color, *outline_color, *size_weight, *line_style;
|
||||
|
||||
|
||||
@@ -822,6 +822,7 @@ bool CustomElement::validOrientationAttribute(const QDomElement &e) {
|
||||
- red : remplissage rouge
|
||||
- blue : remplissage bleu
|
||||
- green : remplissage vert
|
||||
- gray : remplissage gris
|
||||
- none : pas de remplissage [par defaut]
|
||||
- color : couleur du trait et du texte
|
||||
- white : trait noir [par defaut]
|
||||
@@ -829,6 +830,7 @@ bool CustomElement::validOrientationAttribute(const QDomElement &e) {
|
||||
- red : trait rouge
|
||||
- blue : trait bleu
|
||||
- green : trait vert
|
||||
- gray : trait gris
|
||||
|
||||
Les autres valeurs ne sont pas prises en compte.
|
||||
@param e L'element XML a parser
|
||||
@@ -880,6 +882,9 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
|
||||
} else if (style_value == "green") {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::green);
|
||||
} else if (style_value == "gray") {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::gray);
|
||||
} else if (style_value == "none") {
|
||||
brush.setStyle(Qt::NoBrush);
|
||||
}
|
||||
@@ -894,6 +899,8 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
|
||||
pen.setColor(Qt::blue);
|
||||
}else if (style_value == "green") {
|
||||
pen.setColor(Qt::green);
|
||||
}else if (style_value == "gray") {
|
||||
pen.setColor(Qt::gray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user