Conductor: activate option "Don't be subjected to the option one potential text per folio"

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3371 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-10-12 09:29:41 +00:00
parent 0af31b9105
commit a42e7dc422
2 changed files with 75 additions and 15 deletions

View File

@@ -1181,26 +1181,34 @@ QPointF Conductor::posForText(Qt::Orientations &flag) {
* If text was moved by user, this function do nothing, except check if text is near conductor. * If text was moved by user, this function do nothing, except check if text is near conductor.
*/ */
void Conductor::calculateTextItemPosition() { void Conductor::calculateTextItemPosition() {
if (!text_item || !diagram()) return; if (!text_item || !diagram() || properties_.type != ConductorProperties::Multi) return;
if (diagram() -> defaultConductorProperties.m_one_text_per_folio == true) { if (diagram() -> defaultConductorProperties.m_one_text_per_folio == true) {
Conductor *longuest_conductor = longuestConductorInPotential(this); Conductor *longuest_conductor = longuestConductorInPotential(this);
//The longuest conductor isn't this conductor //The longuest conductor isn't this conductor
//we call calculateTextItemPosition of the longuest conductor //we call calculateTextItemPosition of the longuest conductor
if(longuest_conductor != this) { if(longuest_conductor != this) {
longuest_conductor -> calculateTextItemPosition(); longuest_conductor -> calculateTextItemPosition();
return; //This isn't the longuest conductor, if option "m_no_one_text_per_folio" is false we return now
} //else is true, that mean the text is visible, so we need to calcule position
if (properties_.m_no_one_text_per_folio == false) return;
} else {
//At this point this conductor is the longuest conductor //At this point this conductor is the longuest conductor
//we hide all text of conductor_list //we hide all text of conductor_list or setVisible according to the
//properties of current conductor if option "m_no_one_text_per_folio" is true
foreach (Conductor *c, relatedPotentialConductors(false)) { foreach (Conductor *c, relatedPotentialConductors(false)) {
if (c -> properties_.m_no_one_text_per_folio == false)
c -> textItem() -> setVisible(false); c -> textItem() -> setVisible(false);
else
c -> textItem() -> setVisible(c -> properties().m_show_text);
} }
//Make sure text item is visible //Make sure text item is visible
text_item -> setVisible(true); text_item -> setVisible(true);
} }
}
//position //position
if (text_item -> wasMovedByUser()) { if (text_item -> wasMovedByUser()) {

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>633</width> <width>633</width>
<height>461</height> <height>470</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -25,6 +25,9 @@
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QRadioButton" name="m_multi_rb"> <widget class="QRadioButton" name="m_multi_rb">
<property name="toolTip">
<string>Multifilaire</string>
</property>
<property name="text"> <property name="text">
<string>Multifilaire</string> <string>Multifilaire</string>
</property> </property>
@@ -71,7 +74,7 @@
<item> <item>
<widget class="QSpinBox" name="m_text_size_sb"> <widget class="QSpinBox" name="m_text_size_sb">
<property name="toolTip"> <property name="toolTip">
<string>taille</string> <string>Taille du texte</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>5</number> <number>5</number>
@@ -83,6 +86,9 @@
</item> </item>
<item> <item>
<widget class="QCheckBox" name="m_show_text_cb"> <widget class="QCheckBox" name="m_show_text_cb">
<property name="toolTip">
<string>Texte visible</string>
</property>
<property name="text"> <property name="text">
<string>Visible</string> <string>Visible</string>
</property> </property>
@@ -97,15 +103,21 @@
<layout class="QVBoxLayout" name="m_autonum_layout"> <layout class="QVBoxLayout" name="m_autonum_layout">
<item> <item>
<widget class="QCheckBox" name="m_one_text_per_folio_cb"> <widget class="QCheckBox" name="m_one_text_per_folio_cb">
<property name="toolTip">
<string>activer l'option un texte par potentiel</string>
</property>
<property name="text"> <property name="text">
<string>Afficher un seul texte par potentiel présent sur un folio. (expérimental)</string> <string>Afficher un texte de potentiel par folio. (expérimental)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="m_no_one_text_per_folio_cb"> <widget class="QCheckBox" name="m_no_one_text_per_folio_cb">
<property name="toolTip">
<string>Ne pas subir l'option un texte par potentiel</string>
</property>
<property name="text"> <property name="text">
<string>Ne pas subir l'option : afficher un seul texte par potentiel présent sur un folio. (Inactif)</string> <string>Ne pas subir l'option : Afficher un texte de potentiel par folio. (expérimental)</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -150,6 +162,9 @@
</item> </item>
<item> <item>
<widget class="QRadioButton" name="m_single_rb"> <widget class="QRadioButton" name="m_single_rb">
<property name="toolTip">
<string>Unifilaire</string>
</property>
<property name="text"> <property name="text">
<string>Unifilaire</string> <string>Unifilaire</string>
</property> </property>
@@ -186,6 +201,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Nombre de phase</string>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>
@@ -199,6 +217,9 @@
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QCheckBox" name="m_neutral_cb"> <widget class="QCheckBox" name="m_neutral_cb">
<property name="toolTip">
<string>Neutre</string>
</property>
<property name="text"> <property name="text">
<string>neutre</string> <string>neutre</string>
</property> </property>
@@ -210,6 +231,9 @@
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="m_phase_cb"> <widget class="QCheckBox" name="m_phase_cb">
<property name="toolTip">
<string>Phase</string>
</property>
<property name="text"> <property name="text">
<string>phase</string> <string>phase</string>
</property> </property>
@@ -221,6 +245,9 @@
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="QSpinBox" name="m_phase_sb"> <widget class="QSpinBox" name="m_phase_sb">
<property name="toolTip">
<string>Nombre de phase</string>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>
@@ -241,6 +268,9 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QCheckBox" name="m_earth_cb"> <widget class="QCheckBox" name="m_earth_cb">
<property name="toolTip">
<string>Terre</string>
</property>
<property name="text"> <property name="text">
<string>terre</string> <string>terre</string>
</property> </property>
@@ -282,10 +312,17 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="2"> <item row="3" column="2">
<widget class="QComboBox" name="m_line_style_cb"/> <widget class="QComboBox" name="m_line_style_cb">
<property name="toolTip">
<string>Style du conducteur</string>
</property>
</widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="toolTip">
<string>Couleur du conducteur</string>
</property>
<property name="text"> <property name="text">
<string>Couleur :</string> <string>Couleur :</string>
</property> </property>
@@ -293,13 +330,28 @@
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QPushButton" name="m_color_pb"> <widget class="QPushButton" name="m_color_pb">
<property name="toolTip">
<string>Couleur du conducteur</string>
</property>
<property name="accessibleName">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="flat">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="toolTip">
<string>Style du conducteur</string>
</property>
<property name="text"> <property name="text">
<string>Style :</string> <string>Style :</string>
</property> </property>