mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Conductor : remove "simple" conductor, and add option "visible" for text of multiwire conductor
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3338 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -223,7 +223,8 @@ ConductorProperties::ConductorProperties() :
|
|||||||
text_size(9),
|
text_size(9),
|
||||||
verti_rotate_text(270),
|
verti_rotate_text(270),
|
||||||
horiz_rotate_text(0),
|
horiz_rotate_text(0),
|
||||||
style(Qt::SolidLine)
|
style(Qt::SolidLine),
|
||||||
|
m_show_text(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +253,7 @@ void ConductorProperties::toXml(QDomElement &e) const {
|
|||||||
}
|
}
|
||||||
e.setAttribute("num", text);
|
e.setAttribute("num", text);
|
||||||
e.setAttribute("numsize", text_size);
|
e.setAttribute("numsize", text_size);
|
||||||
|
e.setAttribute("displaytext", m_show_text);
|
||||||
e.setAttribute("vertirotatetext", verti_rotate_text);
|
e.setAttribute("vertirotatetext", verti_rotate_text);
|
||||||
e.setAttribute("horizrotatetext", horiz_rotate_text);
|
e.setAttribute("horizrotatetext", horiz_rotate_text);
|
||||||
|
|
||||||
@@ -283,17 +285,19 @@ void ConductorProperties::fromXml(QDomElement &e) {
|
|||||||
// get specific properties for single conductor
|
// get specific properties for single conductor
|
||||||
singleLineProperties.fromXml(e);
|
singleLineProperties.fromXml(e);
|
||||||
type = Single;
|
type = Single;
|
||||||
} else if (e.attribute("type") == typeToString(Simple)) {
|
|
||||||
type = Simple;
|
|
||||||
} else {
|
} else {
|
||||||
type = Multi;
|
type = Multi;
|
||||||
}
|
}
|
||||||
// get text field
|
// get text field
|
||||||
text = e.attribute("num");
|
text = e.attribute("num");
|
||||||
text_size = e.attribute("numsize", QString::number(9)).toInt();
|
text_size = e.attribute("numsize", QString::number(9)).toInt();
|
||||||
|
m_show_text = e.attribute("displaytext", QString::number(1)).toInt();
|
||||||
verti_rotate_text = e.attribute("vertirotatetext").toDouble();
|
verti_rotate_text = e.attribute("vertirotatetext").toDouble();
|
||||||
horiz_rotate_text = e.attribute("horizrotatetext").toDouble();
|
horiz_rotate_text = e.attribute("horizrotatetext").toDouble();
|
||||||
|
|
||||||
|
//Keep retrocompatible with version older than 0,4
|
||||||
|
//If the propertie @type is simple (removed since QET 0,4), we set text no visible.
|
||||||
|
if (e.attribute("type") == "simple") m_show_text = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,6 +310,7 @@ void ConductorProperties::toSettings(QSettings &settings, const QString &prefix)
|
|||||||
settings.setValue(prefix + "type", typeToString(type));
|
settings.setValue(prefix + "type", typeToString(type));
|
||||||
settings.setValue(prefix + "text", text);
|
settings.setValue(prefix + "text", text);
|
||||||
settings.setValue(prefix + "textsize", QString::number(text_size));
|
settings.setValue(prefix + "textsize", QString::number(text_size));
|
||||||
|
settings.setValue(prefix + "displaytext", m_show_text);
|
||||||
settings.setValue(prefix + "vertirotatetext", QString::number(verti_rotate_text));
|
settings.setValue(prefix + "vertirotatetext", QString::number(verti_rotate_text));
|
||||||
settings.setValue(prefix + "horizrotatetext", QString::number(horiz_rotate_text));
|
settings.setValue(prefix + "horizrotatetext", QString::number(horiz_rotate_text));
|
||||||
singleLineProperties.toSettings(settings, prefix);
|
singleLineProperties.toSettings(settings, prefix);
|
||||||
@@ -327,14 +332,13 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi
|
|||||||
QString setting_type = settings.value(prefix + "type", typeToString(Multi)).toString();
|
QString setting_type = settings.value(prefix + "type", typeToString(Multi)).toString();
|
||||||
if (setting_type == typeToString(Single)) {
|
if (setting_type == typeToString(Single)) {
|
||||||
type = Single;
|
type = Single;
|
||||||
} else if (setting_type == typeToString(Simple)) {
|
|
||||||
type = Simple;
|
|
||||||
} else {
|
} else {
|
||||||
type = Multi;
|
type = Multi;
|
||||||
}
|
}
|
||||||
singleLineProperties.fromSettings(settings, prefix);
|
singleLineProperties.fromSettings(settings, prefix);
|
||||||
text = settings.value(prefix + "text", "_").toString();
|
text = settings.value(prefix + "text", "_").toString();
|
||||||
text_size = settings.value(prefix + "textsize", "7").toInt();
|
text_size = settings.value(prefix + "textsize", "7").toInt();
|
||||||
|
m_show_text = settings.value(prefix + "displaytext", true).toBool();
|
||||||
verti_rotate_text = settings.value((prefix + "vertirotatetext"), "270").toDouble();
|
verti_rotate_text = settings.value((prefix + "vertirotatetext"), "270").toDouble();
|
||||||
horiz_rotate_text = settings.value((prefix + "horizrotatetext"), "0").toDouble();
|
horiz_rotate_text = settings.value((prefix + "horizrotatetext"), "0").toDouble();
|
||||||
|
|
||||||
@@ -347,7 +351,6 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi
|
|||||||
*/
|
*/
|
||||||
QString ConductorProperties::typeToString(ConductorType t) {
|
QString ConductorProperties::typeToString(ConductorType t) {
|
||||||
switch(t) {
|
switch(t) {
|
||||||
case Simple: return("simple");
|
|
||||||
case Single: return("single");
|
case Single: return("single");
|
||||||
case Multi: return("multi");
|
case Multi: return("multi");
|
||||||
default: return(QString());
|
default: return(QString());
|
||||||
@@ -364,6 +367,7 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const{
|
|||||||
other.color == color &&\
|
other.color == color &&\
|
||||||
other.style == style &&\
|
other.style == style &&\
|
||||||
other.text == text &&\
|
other.text == text &&\
|
||||||
|
other.m_show_text == m_show_text &&\
|
||||||
other.text_size == text_size &&\
|
other.text_size == text_size &&\
|
||||||
other.verti_rotate_text == verti_rotate_text &&\
|
other.verti_rotate_text == verti_rotate_text &&\
|
||||||
other.horiz_rotate_text == horiz_rotate_text &&\
|
other.horiz_rotate_text == horiz_rotate_text &&\
|
||||||
@@ -376,16 +380,7 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const{
|
|||||||
@return true si les deux ensembles de proprietes sont differents, false sinon
|
@return true si les deux ensembles de proprietes sont differents, false sinon
|
||||||
*/
|
*/
|
||||||
bool ConductorProperties::operator!=(const ConductorProperties &other) const{
|
bool ConductorProperties::operator!=(const ConductorProperties &other) const{
|
||||||
return(
|
return(!(*this == other));
|
||||||
other.type != type ||\
|
|
||||||
other.color != color ||\
|
|
||||||
other.style != style ||\
|
|
||||||
other.text != text ||\
|
|
||||||
other.text_size != text_size ||\
|
|
||||||
other.verti_rotate_text != verti_rotate_text ||\
|
|
||||||
other.horiz_rotate_text != horiz_rotate_text ||\
|
|
||||||
other.singleLineProperties != singleLineProperties
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class ConductorProperties {
|
|||||||
* Single: singleline symbols, no text input
|
* Single: singleline symbols, no text input
|
||||||
* Multi: text input, no symbol
|
* Multi: text input, no symbol
|
||||||
*/
|
*/
|
||||||
enum ConductorType { Simple, Single, Multi };
|
enum ConductorType { Single, Multi };
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
/// Conductor type
|
/// Conductor type
|
||||||
@@ -84,6 +84,7 @@ class ConductorProperties {
|
|||||||
/// rotation angle texte
|
/// rotation angle texte
|
||||||
double verti_rotate_text;
|
double verti_rotate_text;
|
||||||
double horiz_rotate_text;
|
double horiz_rotate_text;
|
||||||
|
bool m_show_text;
|
||||||
/// conducteur style (Qt::SolidLine or Qt::DashLine)
|
/// conducteur style (Qt::SolidLine or Qt::DashLine)
|
||||||
Qt::PenStyle style;
|
Qt::PenStyle style;
|
||||||
|
|
||||||
|
|||||||
@@ -1281,33 +1281,45 @@ QString Conductor::text() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param t Nouveau texte du conducteur
|
* @brief Conductor::setText
|
||||||
*/
|
* The text of this conductor
|
||||||
|
* @param t
|
||||||
|
*/
|
||||||
void Conductor::setText(const QString &t) {
|
void Conductor::setText(const QString &t) {
|
||||||
text_item -> setFontSize(properties_.text_size);
|
|
||||||
text_item -> setPlainText(t);
|
text_item -> setPlainText(t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param p les proprietes de ce conducteur
|
/**
|
||||||
|
* @brief Conductor::setProperties
|
||||||
|
* Set new properties for this conductor
|
||||||
|
* @param p : properties
|
||||||
|
*/
|
||||||
void Conductor::setProperties(const ConductorProperties &p) {
|
void Conductor::setProperties(const ConductorProperties &p) {
|
||||||
properties_ = p;
|
properties_ = p;
|
||||||
readProperties();
|
readProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return les proprietes de ce conducteur
|
/**
|
||||||
|
* @brief Conductor::properties
|
||||||
|
* @return the properties of this Conductor
|
||||||
|
*/
|
||||||
ConductorProperties Conductor::properties() const {
|
ConductorProperties Conductor::properties() const {
|
||||||
return(properties_);
|
return(properties_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Relit les proprietes et les applique
|
* @brief Conductor::readProperties
|
||||||
*/
|
* Read and apply properties
|
||||||
|
*/
|
||||||
void Conductor::readProperties() {
|
void Conductor::readProperties() {
|
||||||
// la couleur n'est vraiment applicable que lors du rendu du conducteur
|
|
||||||
setText(properties_.text);
|
setText(properties_.text);
|
||||||
|
text_item -> setFontSize(properties_.text_size);
|
||||||
|
if (properties_.type != ConductorProperties::Multi) {
|
||||||
|
text_item -> setVisible(false);
|
||||||
|
} else {
|
||||||
|
text_item -> setVisible(properties_.m_show_text);
|
||||||
|
}
|
||||||
calculateTextItemPosition();
|
calculateTextItemPosition();
|
||||||
text_item -> setVisible(properties_.type == ConductorProperties::Multi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
|
|||||||
if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
|
if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
|
||||||
ui -> m_text_le -> setText (m_properties.text);
|
ui -> m_text_le -> setText (m_properties.text);
|
||||||
ui -> m_text_size_sb -> setValue (m_properties.text_size);
|
ui -> m_text_size_sb -> setValue (m_properties.text_size);
|
||||||
|
ui -> m_show_text_cb -> setChecked (m_properties.m_show_text);
|
||||||
ui -> m_earth_cb -> setChecked (m_properties.singleLineProperties.hasGround);
|
ui -> m_earth_cb -> setChecked (m_properties.singleLineProperties.hasGround);
|
||||||
ui -> m_neutral_cb -> setChecked (m_properties.singleLineProperties.hasNeutral);
|
ui -> m_neutral_cb -> setChecked (m_properties.singleLineProperties.hasNeutral);
|
||||||
ui -> m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
|
ui -> m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
|
||||||
@@ -90,13 +91,13 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
|
|||||||
*/
|
*/
|
||||||
ConductorProperties ConductorPropertiesWidget::properties() const {
|
ConductorProperties ConductorPropertiesWidget::properties() const {
|
||||||
ConductorProperties properties_;
|
ConductorProperties properties_;
|
||||||
if (ui -> m_simple_rb -> isChecked()) properties_.type = ConductorProperties::Simple;
|
if (ui -> m_multi_rb -> isChecked()) properties_.type = ConductorProperties::Multi;
|
||||||
else if (ui -> m_multi_rb -> isChecked()) properties_.type = ConductorProperties::Multi;
|
|
||||||
else if (ui -> m_single_rb -> isChecked()) properties_.type = ConductorProperties::Single;
|
else if (ui -> m_single_rb -> 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_.style = static_cast<Qt::PenStyle>(ui->m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).toInt());
|
properties_.style = static_cast<Qt::PenStyle>(ui->m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).toInt());
|
||||||
properties_.text = ui -> m_text_le -> text();
|
properties_.text = ui -> m_text_le -> text();
|
||||||
properties_.text_size = ui -> m_text_size_sb -> value();
|
properties_.text_size = ui -> m_text_size_sb -> value();
|
||||||
|
properties_.m_show_text = ui -> m_show_text_cb -> isChecked();
|
||||||
properties_.verti_rotate_text = m_verti_select -> value();
|
properties_.verti_rotate_text = m_verti_select -> value();
|
||||||
properties_.horiz_rotate_text = m_horiz_select -> value();
|
properties_.horiz_rotate_text = m_horiz_select -> value();
|
||||||
properties_.singleLineProperties.hasGround = ui -> m_earth_cb -> isChecked();
|
properties_.singleLineProperties.hasGround = ui -> m_earth_cb -> isChecked();
|
||||||
@@ -145,9 +146,6 @@ void ConductorPropertiesWidget::initWidget() {
|
|||||||
*/
|
*/
|
||||||
void ConductorPropertiesWidget::setConductorType(ConductorProperties::ConductorType type) {
|
void ConductorPropertiesWidget::setConductorType(ConductorProperties::ConductorType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ConductorProperties::Simple:
|
|
||||||
ui -> m_simple_rb -> setChecked(true);
|
|
||||||
break;
|
|
||||||
case ConductorProperties::Multi:
|
case ConductorProperties::Multi:
|
||||||
ui -> m_multi_rb -> setChecked(true);
|
ui -> m_multi_rb -> setChecked(true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>430</width>
|
<width>430</width>
|
||||||
<height>571</height>
|
<height>407</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -23,13 +23,6 @@
|
|||||||
<string>Type de conducteur</string>
|
<string>Type de conducteur</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="m_simple_rb">
|
|
||||||
<property name="text">
|
|
||||||
<string>Simple</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="m_multi_rb">
|
<widget class="QRadioButton" name="m_multi_rb">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -57,12 +50,16 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Texte par defaut :</string>
|
<string>Texte :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="m_text_le"/>
|
<widget class="QLineEdit" name="m_text_le">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Texte</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
@@ -73,6 +70,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="m_text_size_sb">
|
<widget class="QSpinBox" name="m_text_size_sb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>taille</string>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -81,6 +81,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="m_show_text_cb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Visible</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -256,24 +266,24 @@
|
|||||||
<string>Apparence du conducteur</string>
|
<string>Apparence du conducteur</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="2" column="1">
|
<item row="3" column="2">
|
||||||
<widget class="QComboBox" name="m_line_style_cb"/>
|
<widget class="QComboBox" name="m_line_style_cb"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Couleur :</string>
|
<string>Couleur :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="2">
|
||||||
<widget class="QPushButton" name="m_color_pb">
|
<widget class="QPushButton" name="m_color_pb">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Style :</string>
|
<string>Style :</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user