mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
editor element: style selection, change radio button by combobox
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2662 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
1ec9d9705f
commit
7ae3842a22
@ -37,12 +37,12 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
outline_color -> addItem(tr("Bleu", "element part color"), CustomElementGraphicPart::BlueColor);
|
outline_color -> addItem(tr("Bleu", "element part color"), CustomElementGraphicPart::BlueColor);
|
||||||
|
|
||||||
// style
|
// style
|
||||||
style = new QButtonGroup(this);
|
line_style = new QComboBox(this);
|
||||||
style -> addButton(normal_style = new QRadioButton(tr("Normal", "element part line style")), CustomElementGraphicPart::NormalStyle);
|
line_style -> addItem(tr("Normal", "element part line style"), CustomElementGraphicPart::NormalStyle);
|
||||||
style -> addButton(dashed_style = new QRadioButton(tr("Tiret", "element part line style")), CustomElementGraphicPart::DashedStyle);
|
line_style -> addItem(tr("Tiret", "element part line style"), CustomElementGraphicPart::DashedStyle);
|
||||||
style -> addButton(dotted_style = new QRadioButton(tr("Pointill\351", "element part line style")), CustomElementGraphicPart::DottedStyle);
|
line_style -> addItem(tr("Pointill\351", "element part line style"), CustomElementGraphicPart::DottedStyle);
|
||||||
style -> addButton(dashdotted_style = new QRadioButton(tr("Traits et points", "element part line style")), CustomElementGraphicPart::DashdottedStyle);
|
line_style -> addItem(tr("Traits et points", "element part line style"), CustomElementGraphicPart::DashdottedStyle);
|
||||||
normal_style -> setChecked(true);
|
//normal_style -> setChecked(true);
|
||||||
|
|
||||||
// epaisseur
|
// epaisseur
|
||||||
size_weight = new QComboBox(this);
|
size_weight = new QComboBox(this);
|
||||||
@ -80,20 +80,16 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
main_layout -> addLayout(color_layout);
|
main_layout -> addLayout(color_layout);
|
||||||
|
|
||||||
QHBoxLayout *style_layout = new QHBoxLayout();
|
QHBoxLayout *style_layout = new QHBoxLayout();
|
||||||
style_layout -> addWidget(new QLabel(tr("Style : ")));
|
style_layout -> addWidget(new QLabel(tr("Style : ")), 0, Qt::AlignRight);
|
||||||
style_layout -> addWidget(normal_style);
|
style_layout -> addWidget(line_style);
|
||||||
style_layout -> addWidget(dashed_style);
|
|
||||||
style_layout -> addWidget(dashdotted_style);
|
|
||||||
style_layout -> addWidget(dotted_style);
|
|
||||||
style_layout -> addStretch();
|
|
||||||
main_layout -> addLayout(style_layout);
|
main_layout -> addLayout(style_layout);
|
||||||
main_layout -> addWidget(antialiasing);
|
|
||||||
|
|
||||||
QHBoxLayout *weight_layout = new QHBoxLayout();
|
QHBoxLayout *weight_layout = new QHBoxLayout();
|
||||||
weight_layout -> addWidget(new QLabel(tr("\311paisseur : ")), 0, Qt::AlignRight);
|
weight_layout -> addWidget(new QLabel(tr("\311paisseur : ")), 0, Qt::AlignRight);
|
||||||
weight_layout -> addWidget(size_weight);
|
weight_layout -> addWidget(size_weight);
|
||||||
main_layout -> addLayout(weight_layout);
|
main_layout -> addLayout(weight_layout);
|
||||||
|
main_layout -> addWidget(antialiasing);
|
||||||
|
|
||||||
main_layout -> addSpacing(10);
|
main_layout -> addSpacing(10);
|
||||||
main_layout -> addWidget(new QLabel("<u>" + tr("G\351om\351trie :") + "</u> "));
|
main_layout -> addWidget(new QLabel("<u>" + tr("G\351om\351trie :") + "</u> "));
|
||||||
@ -119,7 +115,7 @@ void StyleEditor::updatePart() {
|
|||||||
part -> setColor(static_cast<CEGP::Color>(outline_color -> currentIndex()));
|
part -> setColor(static_cast<CEGP::Color>(outline_color -> currentIndex()));
|
||||||
|
|
||||||
// applique le style
|
// applique le style
|
||||||
part -> setLineStyle(static_cast<CEGP::LineStyle>(style -> checkedId()));
|
part -> setLineStyle(static_cast<CEGP::LineStyle>(line_style -> currentIndex()));
|
||||||
|
|
||||||
// applique l'epaisseur
|
// applique l'epaisseur
|
||||||
part -> setLineWeight(static_cast<CEGP::LineWeight>(size_weight -> currentIndex()));
|
part -> setLineWeight(static_cast<CEGP::LineWeight>(size_weight -> currentIndex()));
|
||||||
@ -133,7 +129,7 @@ void StyleEditor::updatePartAntialiasing() { addChangePartCommand(tr("style an
|
|||||||
/// Met a jour la couleur du trait et cree un objet d'annulation
|
/// Met a jour la couleur du trait et cree un objet d'annulation
|
||||||
void StyleEditor::updatePartColor() { addChangePartCommand(tr("style couleur"), part, "color", outline_color -> currentIndex());}
|
void StyleEditor::updatePartColor() { addChangePartCommand(tr("style couleur"), part, "color", outline_color -> currentIndex());}
|
||||||
/// Met a jour le style du trait et cree un objet d'annulation
|
/// Met a jour le style du trait et cree un objet d'annulation
|
||||||
void StyleEditor::updatePartLineStyle() { addChangePartCommand(tr("style ligne"), part, "line-style", style -> checkedId()); }
|
void StyleEditor::updatePartLineStyle() { addChangePartCommand(tr("style ligne"), part, "line-style", line_style -> currentIndex());}
|
||||||
/// Met a jour l'epaisseur du trait et cree un objet d'annulation
|
/// Met a jour l'epaisseur du trait et cree un objet d'annulation
|
||||||
void StyleEditor::updatePartLineWeight() { addChangePartCommand(tr("style epaisseur"), part, "line-weight", size_weight -> currentIndex());}
|
void StyleEditor::updatePartLineWeight() { addChangePartCommand(tr("style epaisseur"), part, "line-weight", size_weight -> currentIndex());}
|
||||||
/// Met a jour la couleur de fond et cree un objet d'annulation
|
/// Met a jour la couleur de fond et cree un objet d'annulation
|
||||||
@ -152,7 +148,7 @@ void StyleEditor::updateForm() {
|
|||||||
outline_color -> setCurrentIndex(part -> color());
|
outline_color -> setCurrentIndex(part -> color());
|
||||||
|
|
||||||
// lit le style
|
// lit le style
|
||||||
style -> button(part -> lineStyle()) -> setChecked(true);
|
line_style -> setCurrentIndex(part -> lineStyle());
|
||||||
|
|
||||||
// lit l'epaisseur
|
// lit l'epaisseur
|
||||||
size_weight -> setCurrentIndex(part -> lineWeight());
|
size_weight -> setCurrentIndex(part -> lineWeight());
|
||||||
@ -198,13 +194,13 @@ CustomElementPart *StyleEditor::currentPart() const {
|
|||||||
void StyleEditor::activeConnections(bool active) {
|
void StyleEditor::activeConnections(bool active) {
|
||||||
if (active) {
|
if (active) {
|
||||||
connect (outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor()));
|
connect (outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor()));
|
||||||
connect(style, SIGNAL(buttonClicked(int)), this, SLOT(updatePartLineStyle()));
|
connect(line_style, SIGNAL(activated(int)), this, SLOT(updatePartLineStyle()));
|
||||||
connect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight()));
|
connect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight()));
|
||||||
connect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling()));
|
connect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling()));
|
||||||
connect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing()));
|
connect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing()));
|
||||||
} else {
|
} else {
|
||||||
disconnect(outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor()));
|
disconnect(outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor()));
|
||||||
disconnect(style, SIGNAL(buttonClicked(int)), this, SLOT(updatePartLineStyle()));
|
disconnect(line_style, SIGNAL(activated(int)), this, SLOT(updatePartLineStyle()));
|
||||||
disconnect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight()));
|
disconnect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight()));
|
||||||
disconnect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling()));
|
disconnect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling()));
|
||||||
disconnect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing()));
|
disconnect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing()));
|
||||||
|
@ -40,12 +40,11 @@ class StyleEditor : public ElementItemEditor {
|
|||||||
private:
|
private:
|
||||||
CustomElementGraphicPart *part;
|
CustomElementGraphicPart *part;
|
||||||
QVBoxLayout *main_layout;
|
QVBoxLayout *main_layout;
|
||||||
QButtonGroup *style;
|
|
||||||
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;
|
||||||
QRadioButton *none_weight, *thin_weight, *normal_weight, *no_filling;
|
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;
|
||||||
QCheckBox *antialiasing;
|
QCheckBox *antialiasing;
|
||||||
QComboBox *filling_color, *outline_color, *size_weight;
|
QComboBox *filling_color, *outline_color, *size_weight, *line_style;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user