mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Add basic color for filling symbols
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2181 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -765,6 +765,15 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
|
||||
} else if (style_value == "black") {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::black);
|
||||
} else if (style_value == "blue") {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::blue);
|
||||
} else if (style_value == "red") {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::red);
|
||||
} else if (style_value == "green") {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::green);
|
||||
} else if (style_value == "none") {
|
||||
brush.setStyle(Qt::NoBrush);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,10 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const {
|
||||
if (_filling == NoneFilling) css_like_styles += "none";
|
||||
else if (_filling == BlackFilling) css_like_styles += "black";
|
||||
else if (_filling == WhiteFilling) css_like_styles += "white";
|
||||
else if (_filling == GreenFilling) css_like_styles += "green";
|
||||
else if (_filling == BlueFilling) css_like_styles += "blue";
|
||||
else if (_filling == RedFilling) css_like_styles += "red";
|
||||
|
||||
|
||||
css_like_styles += ";color:";
|
||||
if (_color == WhiteColor) css_like_styles += "white";
|
||||
@@ -76,6 +80,9 @@ 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 == "reed") _filling = RedFilling;
|
||||
else if (style_value == "green") _filling = GreenFilling;
|
||||
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;
|
||||
@@ -126,6 +133,15 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const {
|
||||
} else if (_filling == WhiteFilling) {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::white);
|
||||
} else if (_filling == GreenFilling) {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::green);
|
||||
} else if (_filling == RedFilling) {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::red);
|
||||
} else if (_filling == BlueFilling) {
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
brush.setColor(Qt::blue);
|
||||
}
|
||||
|
||||
// applique la couleur de trait
|
||||
|
||||
@@ -46,7 +46,10 @@ class CustomElementGraphicPart : public CustomElementPart {
|
||||
enum Filling {
|
||||
NoneFilling, ///< No filling (i.e. transparent)
|
||||
BlackFilling, ///< Black filling
|
||||
WhiteFilling ///< White filling
|
||||
WhiteFilling, ///< White filling
|
||||
GreenFilling, ///< Green filling
|
||||
RedFilling, ///< Red filling
|
||||
BlueFilling ///< Green filling
|
||||
};
|
||||
|
||||
/// This enum lists the various line colors available to draw primitives.
|
||||
|
||||
@@ -32,6 +32,7 @@ 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);
|
||||
|
||||
|
||||
// style
|
||||
style = new QButtonGroup(this);
|
||||
@@ -51,7 +52,10 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
filling -> addButton(no_filling = new QRadioButton(tr("Aucun", "element part filling")), CustomElementGraphicPart::NoneFilling );
|
||||
filling -> addButton(black_filling = new QRadioButton(tr("Noir", "element part filling")), CustomElementGraphicPart::BlackFilling);
|
||||
filling -> addButton(white_filling = new QRadioButton(tr("Blanc", "element part filling")), CustomElementGraphicPart::WhiteFilling);
|
||||
|
||||
filling -> addButton(green_filling = new QRadioButton(tr("Vert", "element part filling")), CustomElementGraphicPart::GreenFilling);
|
||||
filling -> addButton(red_filling = new QRadioButton(tr("Rouge", "element part filling")), CustomElementGraphicPart::RedFilling);
|
||||
filling -> addButton(blue_filling = new QRadioButton(tr("Blue", "element part filling")), CustomElementGraphicPart::BlueFilling);
|
||||
|
||||
// antialiasing
|
||||
antialiasing = new QCheckBox(tr("Antialiasing"));
|
||||
|
||||
@@ -91,11 +95,14 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
filling_layout -> addWidget(no_filling);
|
||||
filling_layout -> addWidget(black_filling);
|
||||
filling_layout -> addWidget(white_filling);
|
||||
filling_layout -> addWidget(green_filling);
|
||||
filling_layout -> addWidget(red_filling);
|
||||
filling_layout -> addWidget(blue_filling);
|
||||
filling_layout -> addStretch();
|
||||
main_layout -> addLayout(filling_layout);
|
||||
|
||||
main_layout -> addStretch();
|
||||
|
||||
|
||||
setLayout(main_layout);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ 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;
|
||||
QRadioButton *none_weight, *thin_weight, *normal_weight, *no_filling;
|
||||
QRadioButton *black_filling, *white_filling;
|
||||
QRadioButton *black_filling, *white_filling, *green_filling, *red_filling, *blue_filling;
|
||||
QCheckBox *antialiasing;
|
||||
|
||||
// methods
|
||||
|
||||
Reference in New Issue
Block a user