mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Add bicolor conductor
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4999 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -250,6 +250,10 @@ void ConductorProperties::toXml(QDomElement &e) const
|
|||||||
if (color != QColor(Qt::black))
|
if (color != QColor(Qt::black))
|
||||||
e.setAttribute("color", color.name());
|
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)
|
if (type == Single)
|
||||||
singleLineProperties.toXml(e);
|
singleLineProperties.toXml(e);
|
||||||
|
|
||||||
@@ -281,6 +285,14 @@ void ConductorProperties::fromXml(QDomElement &e)
|
|||||||
QColor xml_color= QColor(e.attribute("color"));
|
QColor xml_color= QColor(e.attribute("color"));
|
||||||
color = (xml_color.isValid()? xml_color : QColor(Qt::black));
|
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
|
// read style of conductor
|
||||||
readStyle(e.attribute("style"));
|
readStyle(e.attribute("style"));
|
||||||
|
|
||||||
@@ -317,6 +329,9 @@ void ConductorProperties::fromXml(QDomElement &e)
|
|||||||
void ConductorProperties::toSettings(QSettings &settings, const QString &prefix) const
|
void ConductorProperties::toSettings(QSettings &settings, const QString &prefix) const
|
||||||
{
|
{
|
||||||
settings.setValue(prefix + "color", color.name());
|
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 + "style", writeStyle());
|
||||||
settings.setValue(prefix + "type", typeToString(type));
|
settings.setValue(prefix + "type", typeToString(type));
|
||||||
settings.setValue(prefix + "text", text);
|
settings.setValue(prefix + "text", text);
|
||||||
@@ -341,6 +356,12 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi
|
|||||||
QColor settings_color = QColor(settings.value(prefix + "color").toString());
|
QColor settings_color = QColor(settings.value(prefix + "color").toString());
|
||||||
color = (settings_color.isValid()? settings_color : QColor(Qt::black));
|
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();
|
QString setting_type = settings.value(prefix + "type", typeToString(Multi)).toString();
|
||||||
type = (setting_type == typeToString(Single)? Single : Multi);
|
type = (setting_type == typeToString(Single)? Single : Multi);
|
||||||
|
|
||||||
@@ -388,13 +409,18 @@ void ConductorProperties::setText(QString text) {
|
|||||||
*/
|
*/
|
||||||
void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> list)
|
void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> list)
|
||||||
{
|
{
|
||||||
if (list.isEmpty())
|
const QList<ConductorProperties> clist = list;
|
||||||
|
|
||||||
|
if (clist.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (list.size() == 1)
|
if (clist.size() == 1)
|
||||||
{
|
{
|
||||||
ConductorProperties cp = list.first();
|
ConductorProperties cp = clist.first();
|
||||||
color = cp.color;
|
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;
|
text = cp.text;
|
||||||
m_formula = cp.m_formula;
|
m_formula = cp.m_formula;
|
||||||
m_function = cp.m_function;
|
m_function = cp.m_function;
|
||||||
@@ -410,9 +436,15 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool equal = true;
|
bool equal = true;
|
||||||
|
QColor c_value;
|
||||||
|
bool b_value;
|
||||||
|
QString s_value;
|
||||||
|
int i_value;
|
||||||
|
double d_value;
|
||||||
|
|
||||||
//Color
|
//Color
|
||||||
QColor c_value = list.first().color;
|
c_value = clist.first().color;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.color != c_value)
|
if (cp.color != c_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -421,9 +453,42 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
color = c_value;
|
color = c_value;
|
||||||
equal = true;
|
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
|
//text
|
||||||
QString s_value = list.first().text;
|
s_value = clist.first().text;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.text != s_value)
|
if (cp.text != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -433,8 +498,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//formula
|
//formula
|
||||||
s_value = list.first().m_formula;
|
s_value = clist.first().m_formula;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.m_formula != s_value)
|
if (cp.m_formula != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -444,8 +509,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//function
|
//function
|
||||||
s_value = list.first().m_function;
|
s_value = clist.first().m_function;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.m_function != s_value)
|
if (cp.m_function != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -455,8 +520,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//Tension protocol
|
//Tension protocol
|
||||||
s_value = list.first().m_tension_protocol;
|
s_value = clist.first().m_tension_protocol;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.m_tension_protocol != s_value)
|
if (cp.m_tension_protocol != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -466,8 +531,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//text size
|
//text size
|
||||||
int i_value = list.first().text_size;
|
i_value = clist.first().text_size;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.text_size != i_value)
|
if (cp.text_size != i_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -477,8 +542,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//conductor size
|
//conductor size
|
||||||
double d_value = list.first().cond_size;
|
d_value = clist.first().cond_size;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.cond_size != d_value)
|
if (cp.cond_size != d_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -488,8 +553,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//show text
|
//show text
|
||||||
bool b_value = list.first().m_show_text;
|
b_value = clist.first().m_show_text;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.m_show_text != b_value)
|
if (cp.m_show_text != b_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -499,8 +564,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//One text per folio
|
//One text per folio
|
||||||
b_value = list.first().m_one_text_per_folio;
|
b_value = clist.first().m_one_text_per_folio;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.m_one_text_per_folio != b_value)
|
if (cp.m_one_text_per_folio != b_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -510,8 +575,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//Text rotation for vertical conducor
|
//Text rotation for vertical conducor
|
||||||
d_value = list.first().verti_rotate_text;
|
d_value = clist.first().verti_rotate_text;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.verti_rotate_text != d_value)
|
if (cp.verti_rotate_text != d_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -521,8 +586,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
equal = true;
|
equal = true;
|
||||||
|
|
||||||
//Text rotation for horizontal conducor
|
//Text rotation for horizontal conducor
|
||||||
d_value = list.first().horiz_rotate_text;
|
d_value = clist.first().horiz_rotate_text;
|
||||||
foreach(ConductorProperties cp, list)
|
for(ConductorProperties cp : clist)
|
||||||
{
|
{
|
||||||
if (cp.horiz_rotate_text != d_value)
|
if (cp.horiz_rotate_text != d_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -556,6 +621,9 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const
|
|||||||
return(
|
return(
|
||||||
other.type == type &&\
|
other.type == type &&\
|
||||||
other.color == color &&\
|
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.style == style &&\
|
||||||
other.text == text &&\
|
other.text == text &&\
|
||||||
other.m_formula == m_formula &&\
|
other.m_formula == m_formula &&\
|
||||||
|
|||||||
@@ -77,18 +77,28 @@ class ConductorProperties
|
|||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
ConductorType type;
|
ConductorType type;
|
||||||
QColor color;
|
|
||||||
|
QColor color,
|
||||||
|
m_color_2;
|
||||||
|
|
||||||
QString text,
|
QString text,
|
||||||
m_function,
|
m_function,
|
||||||
m_tension_protocol,
|
m_tension_protocol,
|
||||||
m_formula;
|
m_formula;
|
||||||
int text_size;
|
|
||||||
double cond_size;
|
int text_size,
|
||||||
double verti_rotate_text;
|
m_dash_size = 1;
|
||||||
double horiz_rotate_text;
|
|
||||||
bool m_show_text;
|
double cond_size,
|
||||||
bool m_one_text_per_folio;
|
verti_rotate_text,
|
||||||
|
horiz_rotate_text;
|
||||||
|
|
||||||
|
bool m_show_text,
|
||||||
|
m_one_text_per_folio,
|
||||||
|
m_bicolor = false;
|
||||||
|
|
||||||
Qt::PenStyle style;
|
Qt::PenStyle style;
|
||||||
|
|
||||||
SingleLineProperties singleLineProperties;
|
SingleLineProperties singleLineProperties;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
|||||||
@@ -456,18 +456,19 @@ QPointF Conductor::extendTerminal(const QPointF &terminal, Qet::Orientation term
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dessine le conducteur sans antialiasing.
|
* @brief Conductor::paint
|
||||||
@param qp Le QPainter a utiliser pour dessiner le conducteur
|
* Draw the conductor
|
||||||
@param options Les options de style pour le conducteur
|
* @param qp
|
||||||
@param qw Le QWidget sur lequel on dessine
|
* @param options
|
||||||
*/
|
* @param qw
|
||||||
|
*/
|
||||||
void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWidget *qw)
|
void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWidget *qw)
|
||||||
{
|
{
|
||||||
Q_UNUSED(qw);
|
Q_UNUSED(qw);
|
||||||
qp -> save();
|
qp -> save();
|
||||||
qp -> setRenderHint(QPainter::Antialiasing, false);
|
qp -> setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
|
||||||
// determine la couleur du conducteur
|
// Set the color of conductor
|
||||||
QColor final_conductor_color(m_properties.color);
|
QColor final_conductor_color(m_properties.color);
|
||||||
if (must_highlight_ == Normal) {
|
if (must_highlight_ == Normal) {
|
||||||
final_conductor_color = QColor::fromRgb(69, 137, 255, 255);
|
final_conductor_color = QColor::fromRgb(69, 137, 255, 255);
|
||||||
@@ -486,24 +487,38 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
|||||||
//Draw the conductor bigger when is hovered
|
//Draw the conductor bigger when is hovered
|
||||||
conductor_pen.setWidthF(m_mouse_over? (m_properties.cond_size) +4 : (m_properties.cond_size));
|
conductor_pen.setWidthF(m_mouse_over? (m_properties.cond_size) +4 : (m_properties.cond_size));
|
||||||
|
|
||||||
// affectation du QPen et de la QBrush modifies au QPainter
|
//Set the QPen and QBrush to the QPainter
|
||||||
qp -> setBrush(conductor_brush);
|
qp -> setBrush(conductor_brush);
|
||||||
QPen final_conductor_pen = conductor_pen;
|
QPen final_conductor_pen = conductor_pen;
|
||||||
|
|
||||||
// modification du QPen generique pour lui affecter la couleur et le style adequats
|
//Set the conductor style
|
||||||
final_conductor_pen.setColor(final_conductor_color);
|
final_conductor_pen.setColor(final_conductor_color);
|
||||||
final_conductor_pen.setStyle(m_properties.style);
|
final_conductor_pen.setStyle(m_properties.style);
|
||||||
final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // meilleur rendu des pointilles
|
final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // better rendering with dot
|
||||||
|
|
||||||
// utilisation d'un trait "cosmetique" en-dessous d'un certain zoom
|
//Use a cosmetique line, below a certain zoom
|
||||||
if (options && options -> levelOfDetail < 1.0) {
|
if (options && options -> levelOfDetail < 1.0) {
|
||||||
final_conductor_pen.setCosmetic(true);
|
final_conductor_pen.setCosmetic(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
qp -> setPen(final_conductor_pen);
|
qp->setPen(final_conductor_pen);
|
||||||
|
|
||||||
// dessin du conducteur
|
//Draw the conductor
|
||||||
qp -> drawPath(path());
|
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<qreal> 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) {
|
if (m_properties.type == ConductorProperties::Single) {
|
||||||
qp -> setBrush(final_conductor_color);
|
qp -> setBrush(final_conductor_color);
|
||||||
m_properties.singleLineProperties.draw(
|
m_properties.singleLineProperties.draw(
|
||||||
@@ -518,17 +533,18 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
|||||||
if (isSelected())
|
if (isSelected())
|
||||||
m_handler.drawHandler(qp, handlerPoints());
|
m_handler.drawHandler(qp, handlerPoints());
|
||||||
|
|
||||||
// dessine les eventuelles jonctions
|
//Draw the junctions
|
||||||
QList<QPointF> junctions_list = junctions();
|
const QList<QPointF> junctions_list = junctions();
|
||||||
if (!junctions_list.isEmpty()) {
|
if (!junctions_list.isEmpty())
|
||||||
|
{
|
||||||
final_conductor_pen.setStyle(Qt::SolidLine);
|
final_conductor_pen.setStyle(Qt::SolidLine);
|
||||||
QBrush junction_brush(final_conductor_color, Qt::SolidPattern);
|
QBrush junction_brush(final_conductor_color, Qt::SolidPattern);
|
||||||
qp -> setPen(final_conductor_pen);
|
qp -> setPen(final_conductor_pen);
|
||||||
qp -> setBrush(junction_brush);
|
qp -> setBrush(junction_brush);
|
||||||
qp -> setRenderHint(QPainter::Antialiasing, true);
|
qp -> setRenderHint(QPainter::Antialiasing, true);
|
||||||
foreach(QPointF point, junctions_list) {
|
|
||||||
|
for(QPointF point : junctions_list)
|
||||||
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qp -> restore();
|
qp -> restore();
|
||||||
|
|||||||
@@ -68,13 +68,18 @@ ConductorPropertiesWidget::~ConductorPropertiesWidget()
|
|||||||
*/
|
*/
|
||||||
void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties)
|
void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties)
|
||||||
{
|
{
|
||||||
if (m_properties == properties) return;
|
if (m_properties == properties)
|
||||||
|
return;
|
||||||
|
|
||||||
m_properties = properties;
|
m_properties = properties;
|
||||||
|
|
||||||
setColorButton(m_properties.color);
|
setColorButton(m_properties.color);
|
||||||
|
setColorButton2(m_properties.m_color_2);
|
||||||
int index = ui -> m_line_style_cb -> findData(QPen(m_properties.style));
|
int index = ui -> m_line_style_cb -> findData(QPen(m_properties.style));
|
||||||
if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
|
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_formula_le -> setText (m_properties.m_formula);
|
||||||
ui->m_text_le -> setText (m_properties.text);
|
ui->m_text_le -> setText (m_properties.text);
|
||||||
ui->m_function_le -> setText (m_properties.m_function);
|
ui->m_function_le -> setText (m_properties.m_function);
|
||||||
@@ -107,6 +112,9 @@ ConductorProperties ConductorPropertiesWidget::properties() const
|
|||||||
else if (ui -> m_singlewire_gb -> isChecked()) properties_.type = ConductorProperties::Single;
|
else if (ui -> m_singlewire_gb -> isChecked()) properties_.type = ConductorProperties::Single;
|
||||||
|
|
||||||
properties_.color = ui -> m_color_pb->palette().color(QPalette::Button);
|
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<QPen>().style();
|
properties_.style = ui -> m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).value<QPen>().style();
|
||||||
properties_.m_formula = ui->m_formula_le->text();
|
properties_.m_formula = ui->m_formula_le->text();
|
||||||
properties_.text = ui -> m_text_le -> text();
|
properties_.text = ui -> m_text_le -> text();
|
||||||
@@ -295,12 +303,24 @@ void ConductorPropertiesWidget::on_m_color_pb_clicked() {
|
|||||||
* Set m_color_pb to @color
|
* Set m_color_pb to @color
|
||||||
* @param color
|
* @param color
|
||||||
*/
|
*/
|
||||||
void ConductorPropertiesWidget::setColorButton(const QColor &color) {
|
void ConductorPropertiesWidget::setColorButton(const QColor &color){
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
palette.setColor(QPalette::Button, color);
|
palette.setColor(QPalette::Button, 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()));
|
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
|
* @brief ConductorPropertiesWidget::on_m_update_preview_pb_clicked
|
||||||
* Update the preview of single line.
|
* Update the preview of single line.
|
||||||
@@ -311,3 +331,14 @@ void ConductorPropertiesWidget::setColorButton(const QColor &color) {
|
|||||||
void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() {
|
void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() {
|
||||||
updatePreview();
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,8 +65,11 @@ class ConductorPropertiesWidget : public QWidget
|
|||||||
void on_m_neutral_cb_toggled(bool checked);
|
void on_m_neutral_cb_toggled(bool checked);
|
||||||
void on_m_color_pb_clicked();
|
void on_m_color_pb_clicked();
|
||||||
void setColorButton (const QColor &color);
|
void setColorButton (const QColor &color);
|
||||||
|
void setColorButton2 (const QColor &color);
|
||||||
void on_m_update_preview_pb_clicked();
|
void on_m_update_preview_pb_clicked();
|
||||||
|
|
||||||
|
void on_m_color_2_pb_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ConductorPropertiesWidget *ui;
|
Ui::ConductorPropertiesWidget *ui;
|
||||||
ConductorProperties m_properties;
|
ConductorProperties m_properties;
|
||||||
|
|||||||
@@ -390,7 +390,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -426,6 +426,55 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QGroupBox" name="m_color_2_gb">
|
||||||
|
<property name="title">
|
||||||
|
<string>Couleur secondaire :</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="m_dash_size_sb">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>px</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="m_color_2_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Couleur :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Taille de trait :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
Reference in New Issue
Block a user