Conductor properties : Add two value, function and tension/protocol.

Revamp some widget to edit it.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4172 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-08-29 14:18:30 +00:00
parent bda6d607b3
commit 1bdb13594b
16 changed files with 557 additions and 397 deletions

View File

@@ -70,31 +70,14 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget *
QPropertyUndoCommand *undo = new QPropertyUndoCommand(conductor, "properties", old_value, new_value);
undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption"));
if (!conductor->relatedPotentialConductors().isEmpty())
if (!conductor->relatedPotentialConductors().isEmpty() && cpd.applyAll())
{
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
QString old_text = conductor->properties().text;
QString new_text = cpd.properties().text;
foreach (Conductor *potential_conductor, conductor->relatedPotentialConductors())
{
//"Apply to all conductors of potential" is checked,
//we apply the new properties for every conductors in the same potential.
if (cpd.applyAll())
{
old_value.setValue(potential_conductor->properties());
new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo);
}
//The num of conductor isn't affected by "Apply to all conductors of potential"
//we always apply it to the potential if he change.
else if(old_text != new_text)
{
old_value.setValue(potential_conductor->properties());
ConductorProperties new_properties = potential_conductor->properties();
new_properties.text = new_text;
new_value.setValue(new_properties);
new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo);
}
old_value.setValue(potential_conductor->properties());
new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo);
}
}

View File

@@ -66,7 +66,8 @@ ConductorPropertiesWidget::~ConductorPropertiesWidget()
* Set the properties
* @param properties
*/
void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties) {
void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties)
{
if (m_properties == properties) return;
m_properties = properties;
@@ -74,18 +75,20 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
int index = ui -> m_line_style_cb -> findData(QPen(m_properties.style));
if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
ui -> m_text_le -> setText (m_properties.text);
ui -> m_text_size_sb -> setValue (m_properties.text_size);
ui -> m_show_text_cb -> setChecked (m_properties.m_show_text);
ui -> m_one_text_per_folio_cb -> setChecked (m_properties.m_one_text_per_folio);
ui -> m_earth_cb -> setChecked (m_properties.singleLineProperties.hasGround);
ui -> m_neutral_cb -> setChecked (m_properties.singleLineProperties.hasNeutral);
ui -> m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
ui -> m_phase_cb -> setChecked (m_properties.singleLineProperties.phasesCount());
ui -> m_phase_slider -> setValue (m_properties.singleLineProperties.phasesCount());
ui->m_text_le -> setText (m_properties.text);
ui->m_function_le ->setText (m_properties.m_function);
ui->m_tension_protocol_le ->setText (m_properties.m_tension_protocol);
ui->m_text_size_sb -> setValue (m_properties.text_size);
ui->m_show_text_cb -> setChecked (m_properties.m_show_text);
ui->m_one_text_per_folio_cb -> setChecked (m_properties.m_one_text_per_folio);
ui->m_earth_cb -> setChecked (m_properties.singleLineProperties.hasGround);
ui->m_neutral_cb -> setChecked (m_properties.singleLineProperties.hasNeutral);
ui->m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
ui->m_phase_cb -> setChecked (m_properties.singleLineProperties.phasesCount());
ui->m_phase_slider -> setValue (m_properties.singleLineProperties.phasesCount());
m_verti_select -> setValue (m_properties.verti_rotate_text);
m_horiz_select -> setValue (m_properties.horiz_rotate_text);
m_verti_select -> setValue (m_properties.verti_rotate_text);
m_horiz_select -> setValue (m_properties.horiz_rotate_text);
setConductorType(m_properties.type);
updatePreview(false);
@@ -95,7 +98,8 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
* @brief ConductorPropertiesWidget::properties
* @return the edited properties
*/
ConductorProperties ConductorPropertiesWidget::properties() const {
ConductorProperties ConductorPropertiesWidget::properties() const
{
ConductorProperties properties_;
if (ui -> m_multiwires_gb -> isChecked()) properties_.type = ConductorProperties::Multi;
else if (ui -> m_singlewire_gb -> isChecked()) properties_.type = ConductorProperties::Single;
@@ -103,6 +107,8 @@ ConductorProperties ConductorPropertiesWidget::properties() const {
properties_.color = ui -> m_color_pb->palette().color(QPalette::Button);
properties_.style = ui -> m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).value<QPen>().style();
properties_.text = ui -> m_text_le -> text();
properties_.m_function = ui -> m_function_le->text();
properties_.m_tension_protocol = ui -> m_tension_protocol_le->text();
properties_.text_size = ui -> m_text_size_sb -> value();
properties_.m_show_text = ui -> m_show_text_cb -> isChecked();
properties_.m_one_text_per_folio = ui -> m_one_text_per_folio_cb -> isChecked();

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>354</width>
<height>329</height>
<width>504</width>
<height>420</height>
</rect>
</property>
<property name="windowTitle">
@@ -33,23 +33,35 @@
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Texte :</string>
<string>Taille du texte :</string>
</property>
</widget>
</item>
<item row="0" column="3">
<item row="2" column="2">
<widget class="QLineEdit" name="m_function_le"/>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="m_text_size_sb">
<property name="toolTip">
<string>Taille du texte</string>
</property>
<property name="wrapping">
<bool>false</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::UpDownArrows</enum>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>5</number>
</property>
@@ -58,14 +70,31 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<item row="3" column="2">
<widget class="QLineEdit" name="m_tension_protocol_le"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Taille :</string>
<string>Tension / Protocole :</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Texte :</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Fonction :</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="m_text_le">
<property name="toolTip">
<string>Texte</string>
@@ -75,13 +104,13 @@
</property>
</widget>
</item>
<item row="0" column="4">
<item row="1" column="3">
<widget class="QCheckBox" name="m_show_text_cb">
<property name="toolTip">
<string>Texte visible</string>
</property>
<property name="text">
<string>Visible</string>
<string/>
</property>
<property name="checked">
<bool>true</bool>

View File

@@ -0,0 +1,224 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "potentialselectordialog.h"
#include "ui_potentialselectordialog.h"
#include "conductor.h"
#include "terminal.h"
#include <QRadioButton>
#include "QPropertyUndoCommand/qpropertyundocommand.h"
#include "diagram.h"
#include "element.h"
#include "reportelement.h"
//### PRIVATE CLASS ###//
/**
* @brief The NewConductorPotentialSelector class
* Use for get the conductor propertie when two potentials is linked by a conductor
*/
class NewConductorPotentialSelector : public AbstractPotentialSelector
{
public:
NewConductorPotentialSelector(Conductor *conductor) :
m_is_valid(false)
{
Terminal *terminal_1 = conductor->terminal1;
Terminal *terminal_2 = conductor->terminal2;
//We temporarily remove the conductor of his two terminals, to get the two existing potential
terminal_1->removeConductor(conductor);
terminal_2->removeConductor(conductor);
if (terminal_1->conductors().isEmpty() || terminal_2->conductors().isEmpty()) return;
m_properties_1 = terminal_1->conductors().first()->properties();
m_conductor_number_1 = terminal_1->conductors().first()->relatedPotentialConductors().size() + 1;
m_properties_2 = terminal_2->conductors().first()->properties();
m_conductor_number_2 = terminal_2->conductors().first()->relatedPotentialConductors().size() + 1;
//Re-add conductor to his terminals.
terminal_1->addConductor(conductor);
terminal_2->addConductor(conductor);
m_is_valid = true;
}
bool isValid() const {return m_is_valid;}
~NewConductorPotentialSelector() {}
private :
bool m_is_valid;
};
/**
* @brief The LinkReportPotentialSelector class
* Use for get the conductor propertie when two potentials is linked with a folio report
*/
class LinkReportPotentialSelector : public AbstractPotentialSelector
{
public:
LinkReportPotentialSelector(Element *report) :
m_is_valid(false)
{
if (report->linkType() & Element::AllReport)
{
//We temporarily unlink report to get the two existing potential
Element *other_report = report->linkedElements().first();
report->unlinkAllElements();
if (report->conductors().isEmpty() || other_report->conductors().isEmpty()) return;
m_properties_1 = report->conductors().first()->properties();
m_conductor_number_1 = report->conductors().first()->relatedPotentialConductors().size() + 1;
m_properties_2 = other_report->conductors().first()->properties();
m_conductor_number_2 = other_report->conductors().first()->relatedPotentialConductors().size() + 1;
//We relink the report
report->linkToElement(other_report);
m_is_valid = true;
}
}
~LinkReportPotentialSelector() {}
bool isValid() const {return m_is_valid;}
private:
bool m_is_valid;
};
//### PRIVATE CLASS ###//
/**
* @brief PotentialSelectorDialog::PotentialSelectorDialog
* Constructor when we link two potentiels together, with a conductor
* @param conductor : the new conductor who connect to existing potential
* @param parent_undo : undo parent to use.
* @param parent : parent widget.
*/
PotentialSelectorDialog::PotentialSelectorDialog(Conductor *conductor, QUndoCommand *parent_undo, QWidget *parent) :
QDialog(parent),
ui(new Ui::PotentialSelectorDialog),
m_conductor(conductor),
m_report(nullptr),
m_parent_undo(parent_undo)
{
ui->setupUi(this);
m_potential_selector = new NewConductorPotentialSelector(conductor);
buildWidget();
}
/**
* @brief PotentialSelectorDialog::PotentialSelectorDialog
* Constructor when we link two potentiels together, with a folio report.
* @param report : one of the report used to link the potentials (report must be linked to another report)
* @param parent_undo : undo parent to use
* @param parent : paren widget
*/
PotentialSelectorDialog::PotentialSelectorDialog(Element *report, QUndoCommand *parent_undo, QWidget *parent) :
QDialog(parent),
ui(new Ui::PotentialSelectorDialog),
m_conductor(nullptr),
m_report(report),
m_parent_undo(parent_undo)
{
ui->setupUi(this);
m_potential_selector = new LinkReportPotentialSelector(report);
buildWidget();
}
PotentialSelectorDialog::~PotentialSelectorDialog()
{
delete ui;
delete m_potential_selector;
}
/**
* @brief PotentialSelectorDialog::buildWidget
* Build the dialog
*/
void PotentialSelectorDialog::buildWidget()
{
QRadioButton *rb1 = new QRadioButton(tr("Le potentiel avec numero de fil %1 est présent %2 fois").arg(m_potential_selector->m_properties_1.text).arg(m_potential_selector->m_conductor_number_1), this);
QRadioButton *rb2 = new QRadioButton(tr("Le potentiel avec numero de fil %1 est présent %2 fois").arg(m_potential_selector->m_properties_2.text).arg(m_potential_selector->m_conductor_number_2), this);
connect(rb1, &QRadioButton::toggled, [this](bool t){if(t) this->m_selected_properties = this->m_potential_selector->m_properties_1;});
connect(rb2, &QRadioButton::toggled, [this](bool t){if(t) this->m_selected_properties = this->m_potential_selector->m_properties_2;});
//Set the radio button of potential with the bigger number of conductors,
//at first position, and check it
if (m_potential_selector->m_conductor_number_1 >= m_potential_selector->m_conductor_number_2)
{
ui->verticalLayout->insertWidget(1, rb1);
ui->verticalLayout->insertWidget(2, rb2);
rb1->setChecked(true);
}
else
{
ui->verticalLayout->insertWidget(1, rb2);
ui->verticalLayout->insertWidget(2, rb1);
rb2->setChecked(true);
}
}
/**
* @brief PotentialSelectorDialog::on_buttonBox_accepted
* Action when user click on OK button
*/
void PotentialSelectorDialog::on_buttonBox_accepted()
{
if (!m_potential_selector->isValid()) return;
if (!m_conductor)
m_conductor = m_report->conductors().first();
ConductorProperties new_properties = m_conductor->properties();
new_properties.text = m_selected_properties.text;
new_properties.m_function = m_selected_properties.m_function;
new_properties.m_tension_protocol = m_selected_properties.m_tension_protocol;
QVariant old_value, new_value;
old_value.setValue(m_conductor->properties());
new_value.setValue(new_properties);
//Set the properties for the new conductor
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, m_parent_undo);
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
//Set the new properties for each conductors of the new potential
foreach(Conductor *cond, m_conductor->relatedPotentialConductors())
{
new_properties = cond->properties();
new_properties.text = m_selected_properties.text;
new_properties.m_function = m_selected_properties.m_function;
new_properties.m_tension_protocol = m_selected_properties.m_tension_protocol;
old_value.setValue(cond->properties());
new_value.setValue(new_properties);
new QPropertyUndoCommand(cond, "properties", old_value, new_value, undo);
}
//There is an undo parent, we stop here, the owner of m_parent_undo will push it to an undo stack
if (m_parent_undo) return;
//There isn't a parent, we push the undo command to diagram undo stack.
if (m_conductor->diagram()) m_conductor->diagram()->undoStack().push(undo);
//We apply the change without undo command
else
{
delete undo;
m_conductor->setProperties(new_properties);
}
}

View File

@@ -0,0 +1,76 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef POTENTIALSELECTORDIALOG_H
#define POTENTIALSELECTORDIALOG_H
#include <QDialog>
#include "conductorproperties.h"
class Conductor;
class QUndoCommand;
class Element;
class AbstractPotentialSelector
{
public:
virtual ~AbstractPotentialSelector() {}
virtual bool isValid() const = 0;
ConductorProperties m_properties_1, m_properties_2;
int m_conductor_number_1, m_conductor_number_2;
};
namespace Ui {
class PotentialSelectorDialog;
}
/**
* @brief The PotentialSelectorDialog class
* This dialog is used when user try to connect two existing potential together.
* The dialog ask to user to make a choice between the properties of the two existing potential,
* to apply it for the new potential.
*
* Each constructor have a QUndoCommand @parent_undo for parameter
* If @parent_undo isn't null, when user click on OK button, the dialog will use the parent-undo
* as parent of the undo command that describe the changes.
* If @parent_undo is null, the created undo-command is push to the undo stack of the parent diagram of a conductor in potential.
* else we apply the change without a QUndoCommand.
*/
class PotentialSelectorDialog : public QDialog
{
Q_OBJECT
public:
explicit PotentialSelectorDialog(Conductor *conductor, QUndoCommand *parent_undo = nullptr, QWidget *parent = nullptr);
explicit PotentialSelectorDialog(Element *report, QUndoCommand *parent_undo = nullptr, QWidget *parent = nullptr);
~PotentialSelectorDialog();
private slots:
void on_buttonBox_accepted();
private:
void buildWidget();
private:
Ui::PotentialSelectorDialog *ui;
Conductor *m_conductor;
Element *m_report;
QUndoCommand *m_parent_undo;
ConductorProperties m_selected_properties;
AbstractPotentialSelector *m_potential_selector;
};
#endif // POTENTIALSELECTORDIALOG_H

View File

@@ -1,46 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PotentialTextsDialog</class>
<widget class="QDialog" name="PotentialTextsDialog">
<class>PotentialSelectorDialog</class>
<widget class="QDialog" name="PotentialSelectorDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>403</width>
<height>94</height>
<width>425</width>
<height>74</height>
</rect>
</property>
<property name="windowTitle">
<string>Textes de potentiel</string>
<string>Sélectionner le potentiel éléctrique</string>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="topMargin">
<number>9</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Les textes de ce potentiel électrique ne sont pas identiques.
Appliquer un texte à l'ensemble de ces conducteurs.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="m_buttons_layout"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="QLabel" name="label">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</spacer>
<property name="text">
<string>Vous tentez de lier deux potentiels différents ensemble.
Veuillez choisir les propriétées à appliquer au nouveau potentiel.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
@@ -59,7 +66,7 @@ Appliquer un texte à l'ensemble de ces conducteurs.</string>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PotentialTextsDialog</receiver>
<receiver>PotentialSelectorDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@@ -75,7 +82,7 @@ Appliquer un texte à l'ensemble de ces conducteurs.</string>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PotentialTextsDialog</receiver>
<receiver>PotentialSelectorDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

View File

@@ -1,105 +0,0 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "conductor.h"
#include "potentialtextsdialog.h"
#include "ui_potentialtextsdialog.h"
#include <QSignalMapper>
#include <QRadioButton>
/**
* @brief PotentialTextsDialog::PotentialTextsDialog
* Constructor
* @param conductor : A Conductor of the potential to check
* @param parent : parent widget
*/
PotentialTextsDialog::PotentialTextsDialog(Conductor *conductor, QWidget *parent) :
QDialog(parent),
ui(new Ui::PotentialTextsDialog),
m_conductor (conductor)
{
ui->setupUi(this);
conductorsTextToMap();
buildRadioList();
}
/**
* @brief PotentialTextsDialog::~PotentialTextsDialog
* Destructor
*/
PotentialTextsDialog::~PotentialTextsDialog()
{
delete ui;
}
/**
* @brief PotentialTextsDialog::selectedText
* @return the selected text
*/
QString PotentialTextsDialog::selectedText() const {
return m_selected_text;
}
/**
* @brief PotentialTextsDialog::buildRadioList
* Build the radio list of this dialog, for selected a text
*/
void PotentialTextsDialog::buildRadioList() {
//map the signal for each radio button create in buildRadioList
m_signal_mapper = new QSignalMapper(this);
connect(m_signal_mapper, SIGNAL(mapped(QString)), this, SLOT(setSelectedText(QString)));
//create a new radio button for each text of @conductorList
for (QMultiMap<int, QString>::ConstIterator it = m_texts.constEnd()-1; it != m_texts.constBegin()-1; --it) {
QRadioButton *rb= new QRadioButton(it.value() + tr(" : est présent ") + QString::number(it.key()) + tr(" fois."), this);
if (it == m_texts.constEnd()-1) {
rb -> setChecked(true);
m_selected_text = it.value();
}
//connect the button to mapper @m_signal_mapper
connect(rb, SIGNAL(clicked()), m_signal_mapper, SLOT(map()));
m_signal_mapper -> setMapping(rb, it.value());
ui -> m_buttons_layout -> addWidget(rb);
}
}
/**
* @brief PotentialTextsDialog::conductorsTextToMap
* Fill the multimap @m_text with all different text found in the same potentil of @m_conductor
* The key "int" of multimap is the number of conductors with the same text.
* The value "QString" of multimap is the text.
*/
void PotentialTextsDialog::conductorsTextToMap() {
QStringList textList;
textList << m_conductor -> text();
foreach(Conductor *c, m_conductor->relatedPotentialConductors()) textList << c -> text();
while (!textList.size() == 0) {
QString t = textList.at(0);
int n = textList.count(t);
textList.removeAll(t);
m_texts.insert(n, t);
}
}
/**
* @brief PotentialTextsDialog::setSelectedText
* @param text
*/
void PotentialTextsDialog::setSelectedText(QString text) {
m_selected_text = text;
}

View File

@@ -1,61 +0,0 @@
/*
Copyright 2006-2015 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef POTENTIALTEXTSDIALOG_H
#define POTENTIALTEXTSDIALOG_H
#include <QDialog>
#include <QMultiMap>
class Conductor;
class QSignalMapper;
namespace Ui {
class PotentialTextsDialog;
}
/**
* @brief The PotentialTextsDialog class
* This dialog show all differents conductors texts at the same
* potential of @conductor.
* The user can select a text in the list.
*/
class PotentialTextsDialog : public QDialog
{
Q_OBJECT
public:
explicit PotentialTextsDialog(Conductor *conductor, QWidget *parent = 0);
~PotentialTextsDialog();
QString selectedText () const;
private:
void buildRadioList();
void conductorsTextToMap();
private slots:
void setSelectedText (QString text);
private:
Ui::PotentialTextsDialog *ui;
Conductor *m_conductor;
QSignalMapper *m_signal_mapper;
QString m_selected_text;
QMultiMap <int, QString> m_texts;
};
#endif // POTENTIALTEXTSDIALOG_H