diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index ec8a43f32..1a21490bb 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -222,6 +222,7 @@ void SingleLineProperties::fromXml(QDomElement &e) { ConductorProperties::ConductorProperties() : type(Multi), color(Qt::black), + text_color(Qt::black), text("_"), text_size(9), cond_size(1), @@ -259,6 +260,7 @@ void ConductorProperties::toXml(QDomElement &e) const singleLineProperties.toXml(e); e.setAttribute("num", text); + e.setAttribute("text_color", text_color.name()); e.setAttribute("formula", m_formula); e.setAttribute("function", m_function); e.setAttribute("tension-protocol", m_tension_protocol); @@ -291,11 +293,11 @@ void ConductorProperties::fromXml(QDomElement &e) // get conductor color QColor xml_color= QColor(e.attribute("color")); color = (xml_color.isValid()? xml_color : QColor(Qt::black)); - + QString bicolor_str = e.attribute("bicolor", "false"); m_bicolor = bicolor_str == "true"? true : false; - QColor xml_color_2 = QColor(e.attribute("color2")); + QColor xml_color_2 = QColor(e.attribute("color2")); m_color_2 = xml_color_2.isValid()? xml_color_2 : QColor(Qt::black); m_dash_size = e.attribute("dash-size", QString::number(1)).toInt(); @@ -313,6 +315,9 @@ void ConductorProperties::fromXml(QDomElement &e) type = Multi; text = e.attribute("num"); + // get text color + QColor xml_text_color= QColor(e.attribute("text_color")); + text_color = (xml_text_color.isValid()? xml_text_color : QColor(Qt::black)); m_formula = e.attribute("formula"); m_function = e.attribute("function"); m_tension_protocol = e.attribute("tension-protocol"); @@ -348,6 +353,7 @@ void ConductorProperties::toSettings(QSettings &settings, const QString &prefix) settings.setValue(prefix + "style", writeStyle()); settings.setValue(prefix + "type", typeToString(type)); settings.setValue(prefix + "text", text); + settings.setValue(prefix + "text_color", text_color.name()); settings.setValue(prefix + "formula", m_formula); settings.setValue(prefix + "function", m_function); settings.setValue(prefix + "tension-protocol", m_tension_protocol); @@ -388,6 +394,8 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi singleLineProperties.fromSettings(settings, prefix); text = settings.value(prefix + "text", "_").toString(); + QColor settings_text_color = QColor(settings.value(prefix + "text_color").toString()); + text_color = (settings_text_color.isValid()? settings_text_color : QColor(Qt::black)); m_formula = settings.value(prefix + "formula", "").toString(); m_function = settings.value(prefix + "function", "").toString(); m_tension_protocol = settings.value(prefix + "tension-protocol", "").toString(); @@ -441,6 +449,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis m_color_2 = cp.m_color_2; m_dash_size = cp.m_dash_size; text = cp.text; + text_color = cp.text_color; m_formula = cp.m_formula; m_function = cp.m_function; m_tension_protocol = cp.m_tension_protocol; @@ -521,6 +530,17 @@ void ConductorProperties::applyForEqualAttributes(QList lis text = s_value; equal = true; + //text color + c_value = clist.first().text_color; + for(ConductorProperties cp : clist) + { + if (cp.text_color != c_value) + equal = false; + } + if (equal) + text_color = c_value; + equal = true; + //formula s_value = clist.first().m_formula; for(ConductorProperties cp : clist) @@ -695,6 +715,7 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const other.m_dash_size == m_dash_size &&\ other.style == style &&\ other.text == text &&\ + other.text_color == text_color &&\ other.m_formula == m_formula &&\ other.m_function == m_function &&\ other.m_tension_protocol == m_tension_protocol &&\ diff --git a/sources/conductorproperties.h b/sources/conductorproperties.h index 2e274862d..3356228ea 100644 --- a/sources/conductorproperties.h +++ b/sources/conductorproperties.h @@ -79,8 +79,9 @@ class ConductorProperties //Attributes ConductorType type; - QColor color, - m_color_2; + QColor color, + m_color_2, + text_color; QString text, m_function, diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 06df4bf39..55bea7a7b 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1552,6 +1552,7 @@ void Conductor::setProperties(const ConductorProperties &property) QFont font = m_text_item->font(); font.setPointSize(m_properties.text_size); m_text_item->setFont(font); + m_text_item->setColor(m_properties.text_color); if (m_properties.type != ConductorProperties::Multi) m_text_item->setVisible(false); diff --git a/sources/ui/conductorpropertieswidget.cpp b/sources/ui/conductorpropertieswidget.cpp index 0c2714b38..40ca02651 100644 --- a/sources/ui/conductorpropertieswidget.cpp +++ b/sources/ui/conductorpropertieswidget.cpp @@ -95,6 +95,7 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert ui->m_phase_slider -> setValue (m_properties.singleLineProperties.phasesCount()); ui->m_color_kpb -> setColor(m_properties.color); ui->m_color_2_kpb -> setColor(m_properties.m_color_2); + ui->m_text_color_kpb -> setColor(m_properties.text_color); ui->m_horiz_cb->setCurrentIndex(m_properties.m_horizontal_alignment == Qt::AlignTop? 0 : 1); ui->m_verti_cb->setCurrentIndex(m_properties.m_vertical_alignment == Qt::AlignLeft? 0 : 1); @@ -122,6 +123,7 @@ ConductorProperties ConductorPropertiesWidget::properties() const properties_.style = ui -> m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).value().style(); properties_.m_formula = ui->m_formula_le->text(); properties_.text = ui -> m_text_le -> text(); + properties_.text_color = ui -> m_text_color_kpb->color(); properties_.m_function = ui -> m_function_le->text(); properties_.m_tension_protocol = ui -> m_tension_protocol_le->text(); properties_.m_wire_color = ui -> m_wire_color_le->text(); diff --git a/sources/ui/conductorpropertieswidget.ui b/sources/ui/conductorpropertieswidget.ui index 2375d22a5..fc316d30b 100644 --- a/sources/ui/conductorpropertieswidget.ui +++ b/sources/ui/conductorpropertieswidget.ui @@ -7,14 +7,14 @@ 0 0 662 - 346 + 372 Form - - + + 0 @@ -51,153 +51,169 @@ true - + + + + + activer l'option un texte par potentiel + + + Afficher un texte de potentiel par folio. + + + - - - - - Autonumérotation - - - - - - - Tension / Protocole : - - - - - - - true - - - - - - - Fonction : - - - - - - - Texte visible - - - - - - true - - - - - - - true - - - - - - - Texte : - - - - - - - Formule du texte : - - - - - - - éditer les numérotations - - - - - - - :/ico/16x16/configure.png:/ico/16x16/configure.png - - - - - - - Taille du texte : - - - - - - - Couleur du conducteur - - - - - - - - - - Taille du texte - - - false - - - QAbstractSpinBox::UpDownArrows - - - - - - 3 - - - 99 - - - - - - - - - - - - - Texte - - - true - - - - - - - Section du conducteur - - - - - - - + + + Taille du texte : + + + + + + + Taille du texte + + + false + + + QAbstractSpinBox::UpDownArrows + + + + + + 3 + + + 99 + + + + + + + Fonction : + + + + + + + true + + + + + + + Formule du texte : + + + + + + + + + + Tension / Protocole : + + + + + + + true + + + + + Texte : + + + + + + + Texte + + + true + + + + + + + Texte visible + + + + + + true + + + + + + + Couleur du conducteur + + + + + + + + + + Text color: + + + + + + + + + + Section du conducteur + + + + + + + + + + Autonumérotation + + + + + + + + + + éditer les numérotations + + + + + + + :/ico/16x16/configure.png:/ico/16x16/configure.png + + + + @@ -239,19 +255,9 @@ - + - - - - activer l'option un texte par potentiel - - - Afficher un texte de potentiel par folio. - - - @@ -405,7 +411,17 @@ Apparence - + + + + + + + Taille : + + + + Qt::Vertical @@ -418,29 +434,13 @@ - - + + - Couleur du conducteur + Style du conducteur - Couleur : - - - - - - - 0.400000000000000 - - - 20.000000000000000 - - - 0.200000000000000 - - - 1.000000000000000 + Style : @@ -489,10 +489,19 @@ - - - - Taille : + + + + 0.400000000000000 + + + 20.000000000000000 + + + 0.200000000000000 + + + 1.000000000000000 @@ -503,19 +512,16 @@ - - + + - Style du conducteur + Couleur du conducteur - Style : + Couleur : - - -