diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index c3a4013c8..b20b850ac 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -250,9 +250,6 @@ void ConductorProperties::toXml(QDomElement &e) const if (color != QColor(Qt::black)) e.setAttribute("color", color.name()); - e.setAttribute("bicolor", m_bicolor? "true" : "false"); - e.setAttribute("color2", m_color_2.name()); - e.setAttribute("dash-size", QString::number(m_dash_size)); if (type == Single) singleLineProperties.toXml(e); @@ -285,14 +282,6 @@ void ConductorProperties::fromXml(QDomElement &e) 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")); - m_color_2 = xml_color_2.isValid()? xml_color_2 : QColor(Qt::black); - - m_dash_size = e.attribute("dash-size", QString::number(1)).toInt(); - // read style of conductor readStyle(e.attribute("style")); @@ -329,9 +318,6 @@ void ConductorProperties::fromXml(QDomElement &e) void ConductorProperties::toSettings(QSettings &settings, const QString &prefix) const { settings.setValue(prefix + "color", color.name()); - settings.setValue(prefix + "bicolor", m_bicolor); - settings.setValue(prefix + "color2", m_color_2.name()); - settings.setValue(prefix + "dash-size", m_dash_size); settings.setValue(prefix + "style", writeStyle()); settings.setValue(prefix + "type", typeToString(type)); settings.setValue(prefix + "text", text); @@ -356,12 +342,6 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi QColor settings_color = QColor(settings.value(prefix + "color").toString()); color = (settings_color.isValid()? settings_color : QColor(Qt::black)); - QColor settings_color_2 = QColor(settings.value(prefix + "color2").toString()); - m_color_2 = (settings_color_2.isValid()? settings_color_2 : QColor(Qt::black)); - - m_bicolor = settings.value(prefix + "bicolor", false).toBool(); - m_dash_size = settings.value(prefix + "dash-size", 1).toInt(); - QString setting_type = settings.value(prefix + "type", typeToString(Multi)).toString(); type = (setting_type == typeToString(Single)? Single : Multi); @@ -418,9 +398,6 @@ void ConductorProperties::applyForEqualAttributes(QList lis { ConductorProperties cp = clist.first(); color = cp.color; - m_bicolor = cp.m_bicolor; - m_color_2 = cp.m_color_2; - m_dash_size = cp.m_dash_size; text = cp.text; m_formula = cp.m_formula; m_function = cp.m_function; @@ -452,39 +429,6 @@ void ConductorProperties::applyForEqualAttributes(QList lis if (equal) color = c_value; equal = true; - - //bicolor - b_value = clist.first().m_bicolor; - for(ConductorProperties cp : clist) - { - if (cp.m_bicolor != b_value) - equal = false; - } - if (equal) - m_bicolor = b_value; - equal = true; - - //second color - c_value = clist.first().m_color_2; - for(ConductorProperties cp : clist) - { - if (cp.m_color_2 != c_value) - equal = false; - } - if (equal) - m_color_2 = c_value; - equal = true; - - //Dash size - i_value = clist.first().m_dash_size; - for(ConductorProperties cp : clist) - { - if (cp.m_dash_size != i_value) - equal = false; - } - if (equal) - m_dash_size = i_value; - equal = true; //text s_value = clist.first().text; @@ -621,9 +565,6 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const return( other.type == type &&\ other.color == color &&\ - other.m_bicolor == m_bicolor &&\ - other.m_color_2 == m_color_2 &&\ - other.m_dash_size == m_dash_size &&\ other.style == style &&\ other.text == text &&\ other.m_formula == m_formula &&\ diff --git a/sources/conductorproperties.h b/sources/conductorproperties.h index db5cdd829..ace12fc0c 100644 --- a/sources/conductorproperties.h +++ b/sources/conductorproperties.h @@ -78,24 +78,21 @@ class ConductorProperties //Attributes ConductorType type; - QColor color, - m_color_2; + QColor color; QString text, m_function, m_tension_protocol, m_formula; - int text_size, - m_dash_size = 1; + int text_size; double cond_size, verti_rotate_text, horiz_rotate_text; bool m_show_text, - m_one_text_per_folio, - m_bicolor = false; + m_one_text_per_folio; Qt::PenStyle style; diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index a094fc974..a0050da1d 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -513,19 +513,6 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi //Draw the conductor qp -> drawPath(path()); - //Draw the second color - if(m_properties.m_bicolor) - { - final_conductor_pen.setColor(m_properties.m_color_2); - final_conductor_pen.setStyle(Qt::CustomDashLine); - QVector dash_pattern; - dash_pattern << m_properties.m_dash_size-2 << m_properties.m_dash_size; - final_conductor_pen.setDashPattern(dash_pattern); - qp->save(); - qp->setPen(final_conductor_pen); - qp->drawPath(path()); - qp->restore(); - } if (m_properties.type == ConductorProperties::Single) { qp -> setBrush(final_conductor_color); @@ -718,6 +705,11 @@ bool Conductor::sceneEventFilter(QGraphicsItem *watched, QEvent *event) handlerMouseReleaseEvent(qghi, static_cast(event)); return true; } + else if (event->type() == QEvent::GraphicsSceneMouseDoubleClick) //Double click + { + editProperty(); + return true; + } } } } diff --git a/sources/ui/conductorpropertieswidget.cpp b/sources/ui/conductorpropertieswidget.cpp index 792a421f1..4e2bf91b6 100644 --- a/sources/ui/conductorpropertieswidget.cpp +++ b/sources/ui/conductorpropertieswidget.cpp @@ -74,12 +74,9 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert m_properties = properties; setColorButton(m_properties.color); - setColorButton2(m_properties.m_color_2); int index = ui -> m_line_style_cb -> findData(QPen(m_properties.style)); if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index); - ui->m_color_2_gb -> setChecked (m_properties.m_bicolor); - ui->m_dash_size_sb -> setValue (m_properties.m_dash_size); ui->m_formula_le -> setText (m_properties.m_formula); ui->m_text_le -> setText (m_properties.text); ui->m_function_le -> setText (m_properties.m_function); @@ -112,9 +109,6 @@ ConductorProperties ConductorPropertiesWidget::properties() const else if (ui -> m_singlewire_gb -> isChecked()) properties_.type = ConductorProperties::Single; properties_.color = ui -> m_color_pb->palette().color(QPalette::Button); - properties_.m_bicolor = ui->m_color_2_gb->isChecked(); - properties_.m_color_2 = ui->m_color_2_pb->palette().color(QPalette::Button); - properties_.m_dash_size = ui->m_dash_size_sb->value(); 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(); @@ -309,18 +303,6 @@ void ConductorPropertiesWidget::setColorButton(const QColor &color){ ui -> m_color_pb -> setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name())); } -/** - * @brief ConductorPropertiesWidget::setColorButton2 - * Set m_color_2_pb to @color - * @param color - */ -void ConductorPropertiesWidget::setColorButton2(const QColor &color) -{ - QPalette palette; - palette.setColor(QPalette::Button, color); - ui->m_color_2_pb->setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name())); -} - /** * @brief ConductorPropertiesWidget::on_m_update_preview_pb_clicked * Update the preview of single line. @@ -331,14 +313,3 @@ void ConductorPropertiesWidget::setColorButton2(const QColor &color) void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() { updatePreview(); } - -/** - * @brief ConductorPropertiesWidget::on_m_color_2_pb_clicked - * Open a color dialog, for choose the second color of conductor - */ -void ConductorPropertiesWidget::on_m_color_2_pb_clicked() -{ - QColor color = QColorDialog::getColor(m_properties.m_color_2, this); - if (color.isValid()) - setColorButton2(color); -} diff --git a/sources/ui/conductorpropertieswidget.h b/sources/ui/conductorpropertieswidget.h index 07a968748..882bbf3f0 100644 --- a/sources/ui/conductorpropertieswidget.h +++ b/sources/ui/conductorpropertieswidget.h @@ -65,10 +65,7 @@ class ConductorPropertiesWidget : public QWidget void on_m_neutral_cb_toggled(bool checked); void on_m_color_pb_clicked(); void setColorButton (const QColor &color); - void setColorButton2 (const QColor &color); void on_m_update_preview_pb_clicked(); - - void on_m_color_2_pb_clicked(); private: Ui::ConductorPropertiesWidget *ui; diff --git a/sources/ui/conductorpropertieswidget.ui b/sources/ui/conductorpropertieswidget.ui index 7a7694c60..182432a3e 100644 --- a/sources/ui/conductorpropertieswidget.ui +++ b/sources/ui/conductorpropertieswidget.ui @@ -390,7 +390,7 @@ - + Qt::Vertical @@ -426,55 +426,6 @@ - - - - Couleur secondaire : - - - true - - - true - - - false - - - - - - px - - - 2 - - - - - - - - - - - - - - Couleur : - - - - - - - Taille de trait : - - - - - -