[qet] [2660] Add widget combobox line weight to element editor |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2660
Author: scorpio810
Date: 2013-12-19 16:22:12 +0100 (Thu, 19 Dec 2013)
Log Message:
-----------
Add widget combobox line weight to element editor
Modified Paths:
--------------
trunk/sources/editor/customelementgraphicpart.cpp
trunk/sources/editor/customelementgraphicpart.h
trunk/sources/editor/styleeditor.cpp
trunk/sources/editor/styleeditor.h
trunk/sources/qetgraphicsitem/customelement.cpp
Modified: trunk/sources/editor/customelementgraphicpart.cpp
===================================================================
--- trunk/sources/editor/customelementgraphicpart.cpp 2013-12-18 23:58:49 UTC (rev 2659)
+++ trunk/sources/editor/customelementgraphicpart.cpp 2013-12-19 15:22:12 UTC (rev 2660)
@@ -35,7 +35,10 @@
if (_lineweight == NoneWeight) css_like_styles += "none";
else if (_lineweight == ThinWeight) css_like_styles += "thin";
else if (_lineweight == NormalWeight) css_like_styles += "normal";
-
+ else if (_lineweight == UltraWeight) css_like_styles += "hight";
+ else if (_lineweight == BigWeight) css_like_styles += "eleve";
+
+
css_like_styles += ";filling:";
if (_filling == NoneFilling) css_like_styles += "none";
else if (_filling == BlackFilling) css_like_styles += "black";
@@ -79,9 +82,11 @@
else if (style_value == "normal") _linestyle = NormalStyle;
// il n'y a pas de else car les valeurs non conformes sont ignorees (idem par la suite)
} else if (style_name == "line-weight") {
- if (style_value == "thin") _lineweight = ThinWeight;
+ if (style_value == "none") _lineweight = NoneWeight;
+ else if (style_value == "thin") _lineweight = ThinWeight;
else if (style_value == "normal") _lineweight = NormalWeight;
- else if (style_value == "none") _lineweight = NoneWeight;
+ else if (style_value == "hight") _lineweight = UltraWeight;
+ else if (style_value == "eleve") _lineweight = BigWeight;
} else if (style_name == "filling") {
if (style_value == "white") _filling = WhiteFilling;
else if (style_value == "black") _filling = BlackFilling;
@@ -129,9 +134,13 @@
else if (_linestyle == NormalStyle) pen.setStyle(Qt::SolidLine);
// applique l'epaisseur de trait
- if (_lineweight == NoneWeight) pen.setColor(QColor(0, 0, 0, 0));
- else if (_lineweight == ThinWeight) pen.setWidth(0);
- else if (_lineweight == NormalWeight) pen.setWidthF(1.0);
+ if (_lineweight == NoneWeight) pen.setColor(QColor(0, 0, 0, 0));
+ else if (_lineweight == ThinWeight) pen.setWidth(0);
+ else if (_lineweight == NormalWeight) pen.setWidthF(1.0);
+ else if (_lineweight == UltraWeight) pen.setWidthF(2.0);
+ else if (_lineweight == BigWeight) pen.setWidthF(5.0);
+
+
// applique le remplissage
if (_filling == NoneFilling) {
Modified: trunk/sources/editor/customelementgraphicpart.h
===================================================================
--- trunk/sources/editor/customelementgraphicpart.h 2013-12-18 23:58:49 UTC (rev 2659)
+++ trunk/sources/editor/customelementgraphicpart.h 2013-12-19 15:22:12 UTC (rev 2660)
@@ -38,9 +38,12 @@
/// This enum lists the various line weights available to draw primitives.
enum LineWeight {
- NormalWeight, ///< Normal line
+ NoneWeight, ///< Invisible line
ThinWeight, ///< Thin line
- NoneWeight ///< Invisible line
+ NormalWeight, ///< Normal line 1px
+ UltraWeight, ///< Normal line 2px
+ BigWeight ///< Big Line
+
};
/// This enum lists the various filling colors available to draw primitives.
Modified: trunk/sources/editor/styleeditor.cpp
===================================================================
--- trunk/sources/editor/styleeditor.cpp 2013-12-18 23:58:49 UTC (rev 2659)
+++ trunk/sources/editor/styleeditor.cpp 2013-12-19 15:22:12 UTC (rev 2660)
@@ -45,11 +45,13 @@
normal_style -> setChecked(true);
// epaisseur
- weight = new QButtonGroup(this);
- weight -> addButton(none_weight = new QRadioButton(tr("Nulle", "element part weight")), CustomElementGraphicPart::NoneWeight);
- weight -> addButton(thin_weight = new QRadioButton(tr("Fine", "element part weight")), CustomElementGraphicPart::ThinWeight);
- weight -> addButton(normal_weight = new QRadioButton(tr("Normale", "element part weight")), CustomElementGraphicPart::NormalWeight);
-
+ size_weight = new QComboBox(this);
+ size_weight -> addItem(tr("Nulle", "element part weight"), CustomElementGraphicPart::NoneWeight);
+ size_weight -> addItem(tr("Fine", "element part weight"), CustomElementGraphicPart::ThinWeight);
+ size_weight -> addItem(tr("Normale", "element part weight"), CustomElementGraphicPart::NormalWeight);
+ size_weight -> addItem(tr("Forte", "element part weight"), CustomElementGraphicPart::UltraWeight);
+ size_weight -> addItem(tr("\311lev\351", "element part weight"), CustomElementGraphicPart::BigWeight);
+
// remplissage
filling_color = new QComboBox (this);
filling_color -> addItem(tr("Aucun", "element part filling"), CustomElementGraphicPart::NoneFilling);
@@ -85,16 +87,14 @@
style_layout -> addWidget(dotted_style);
style_layout -> addStretch();
main_layout -> addLayout(style_layout);
-
+ main_layout -> addWidget(antialiasing);
+
QHBoxLayout *weight_layout = new QHBoxLayout();
- weight_layout -> addWidget(new QLabel(tr("\311paisseur : ")));
- weight_layout -> addWidget(none_weight);
- weight_layout -> addWidget(thin_weight);
- weight_layout -> addWidget(normal_weight);
- weight_layout -> addStretch();
+ weight_layout -> addWidget(new QLabel(tr("\311paisseur : ")), 0, Qt::AlignRight);
+ weight_layout -> addWidget(size_weight);
main_layout -> addLayout(weight_layout);
- main_layout -> addWidget(antialiasing);
+
main_layout -> addSpacing(10);
main_layout -> addWidget(new QLabel("<u>" + tr("G\351om\351trie :") + "</u> "));
main_layout -> addStretch();
@@ -122,8 +122,8 @@
part -> setLineStyle(static_cast<CEGP::LineStyle>(style -> checkedId()));
// applique l'epaisseur
- part -> setLineWeight(static_cast<CEGP::LineWeight>(weight -> checkedId()));
-
+ part -> setLineWeight(static_cast<CEGP::LineWeight>(size_weight -> currentIndex()));
+
// applique le remplissage
part -> setFilling(static_cast<CEGP::Filling>(filling_color -> currentIndex()));
}
@@ -135,7 +135,7 @@
/// 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()); }
/// Met a jour l'epaisseur du trait et cree un objet d'annulation
-void StyleEditor::updatePartLineWeight() { addChangePartCommand(tr("style epaisseur"), part, "line-weight", weight -> checkedId()); }
+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
void StyleEditor::updatePartFilling() { addChangePartCommand(tr("style remplissage"), part, "filling", filling_color -> currentIndex());}
@@ -155,8 +155,8 @@
style -> button(part -> lineStyle()) -> setChecked(true);
// lit l'epaisseur
- weight -> button(part -> lineWeight()) -> setChecked(true);
-
+ size_weight -> setCurrentIndex(part -> lineWeight());
+
// lit le remplissage
filling_color -> setCurrentIndex(part -> filling());
activeConnections(true);
@@ -199,13 +199,13 @@
if (active) {
connect (outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor()));
connect(style, SIGNAL(buttonClicked(int)), this, SLOT(updatePartLineStyle()));
- connect(weight, SIGNAL(buttonClicked(int)), this, SLOT(updatePartLineWeight()));
+ connect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight()));
connect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling()));
connect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing()));
} else {
disconnect(outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor()));
disconnect(style, SIGNAL(buttonClicked(int)), this, SLOT(updatePartLineStyle()));
- disconnect(weight, SIGNAL(buttonClicked(int)), this, SLOT(updatePartLineWeight()));
+ disconnect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight()));
disconnect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling()));
disconnect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing()));
}
Modified: trunk/sources/editor/styleeditor.h
===================================================================
--- trunk/sources/editor/styleeditor.h 2013-12-18 23:58:49 UTC (rev 2659)
+++ trunk/sources/editor/styleeditor.h 2013-12-19 15:22:12 UTC (rev 2660)
@@ -40,12 +40,12 @@
private:
CustomElementGraphicPart *part;
QVBoxLayout *main_layout;
- QButtonGroup *style, *weight;
+ QButtonGroup *style;
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 *black_filling, *white_filling, *green_filling, *red_filling, *blue_filling;
QCheckBox *antialiasing;
- QComboBox *filling_color, *outline_color;
+ QComboBox *filling_color, *outline_color, *size_weight;
// methods
public:
Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp 2013-12-18 23:58:49 UTC (rev 2659)
+++ trunk/sources/qetgraphicsitem/customelement.cpp 2013-12-19 15:22:12 UTC (rev 2660)
@@ -719,6 +719,9 @@
- line-weight : epaiseur du trait
- thin : trait fin
- normal : trait d'epaisseur 1 [par defaut]
+ - none : trait invisible
+ - forte : trait d'epaisseur 2
+ - eleve : trait d'epaisseur 5
- filling : remplissage de la forme
- white : remplissage blanc
- black : remplissage noir
@@ -761,9 +764,12 @@
else if (style_value == "dashdotted") pen.setStyle(Qt::DashDotLine);
else if (style_value == "normal") pen.setStyle(Qt::SolidLine);
} else if (style_name == "line-weight") {
- if (style_value == "thin") pen.setWidth(0);
+ if (style_value == "none") pen.setColor(QColor(0, 0, 0, 0));
+ else if (style_value == "thin") pen.setWidth(0);
else if (style_value == "normal") pen.setWidthF(1.0);
- else if (style_value == "none") pen.setColor(QColor(0, 0, 0, 0));
+ else if (style_value == "hight") pen.setWidthF(2.0);
+ else if (style_value == "eleve") pen.setWidthF(5.0);
+
} else if (style_name == "filling") {
if (style_value == "white") {
brush.setStyle(Qt::SolidPattern);