mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
conductor autonum. Diagram save current selected autonum.
Readd dialog to select texts, when potential have different texts git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3251 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -16,12 +16,12 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "conductorautonumerotation.h"
|
#include "conductorautonumerotation.h"
|
||||||
#include "conductorautonumerotationwidget.h"
|
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
#include "numerotationcontextcommands.h"
|
#include "numerotationcontextcommands.h"
|
||||||
#include "qetdiagrameditor.h"
|
#include "qetdiagrameditor.h"
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
|
#include "potentialtextsdialog.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Constructor
|
*Constructor
|
||||||
@@ -45,10 +45,10 @@ void ConductorAutoNumerotation::numerate() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::checkPotential
|
* @brief ConductorAutoNumerotation::checkPotential
|
||||||
* Check if text of this potential is identical.
|
* Check if eah texts of this potential is identical.
|
||||||
* If not, ask user how to numerate
|
* If not, ask user how to numerate
|
||||||
* @param conductor
|
* @param conductor
|
||||||
* One conductor of this potential.
|
* A conductor of the potential to check.
|
||||||
*/
|
*/
|
||||||
void ConductorAutoNumerotation::checkPotential(Conductor *conductor) {
|
void ConductorAutoNumerotation::checkPotential(Conductor *conductor) {
|
||||||
//fill list of potential
|
//fill list of potential
|
||||||
@@ -60,10 +60,11 @@ void ConductorAutoNumerotation::checkPotential(Conductor *conductor) {
|
|||||||
|
|
||||||
//check text list, isn't same in potential, ask user what to do
|
//check text list, isn't same in potential, ask user what to do
|
||||||
if (!eachIsEqual(strl)) {
|
if (!eachIsEqual(strl)) {
|
||||||
ConductorAutoNumerotationWidget canw(c_list, conductor -> diagramEditor());
|
PotentialTextsDialog ptd(conductor, conductor->diagramEditor());
|
||||||
ConductorAutoNumerotation can(conductor);
|
if ( ptd.exec() == QDialog::Accepted ) {
|
||||||
//connect(&canw, SIGNAL(textIsSelected(QString)), &can, SLOT(applyText(QString)));
|
ConductorAutoNumerotation can(conductor);
|
||||||
canw.exec();
|
can.applyText(ptd.selectedText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +119,10 @@ void ConductorAutoNumerotation::numeratePotential() {
|
|||||||
}
|
}
|
||||||
//the texts isn't identicals
|
//the texts isn't identicals
|
||||||
else {
|
else {
|
||||||
ConductorAutoNumerotationWidget *canw = new ConductorAutoNumerotationWidget(conductor_list, conductor_ -> diagramEditor());
|
PotentialTextsDialog ptd (conductor_, conductor_ -> diagramEditor());
|
||||||
/*connect(canw, SIGNAL(textIsSelected(QString)),
|
if (ptd.exec() == QDialog::Accepted) {
|
||||||
this, SLOT(applyText(QString)));*/
|
applyText(ptd.selectedText());
|
||||||
canw -> exec();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,135 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2006-2014 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 "conductorautonumerotationwidget.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constructor
|
|
||||||
*/
|
|
||||||
ConductorAutoNumerotationWidget::ConductorAutoNumerotationWidget(QSet<Conductor *> cl, QWidget *parent) :
|
|
||||||
QDialog (parent),
|
|
||||||
c_list(cl)
|
|
||||||
{
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
setWindowFlags(Qt::Sheet);
|
|
||||||
#endif
|
|
||||||
buildInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ConductorAutoNumerotationWidget::buildInterface
|
|
||||||
*/
|
|
||||||
void ConductorAutoNumerotationWidget::buildInterface() {
|
|
||||||
QVBoxLayout *mainlayout = new QVBoxLayout;
|
|
||||||
QGroupBox *potential_groupbox = new QGroupBox(tr("Textes de potentiel"), this);
|
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
|
||||||
|
|
||||||
QLabel *label= new QLabel(tr("Les textes de ce potentiel \351lectrique ne sont pas identiques.\n"
|
|
||||||
"Appliquer un texte \340 l'ensemble de ces conducteurs?"), this);
|
|
||||||
vlayout -> addWidget(label);
|
|
||||||
|
|
||||||
//map the signal for each radio button create in buildRadioList
|
|
||||||
sm_ = new QSignalMapper(this);
|
|
||||||
connect(sm_, SIGNAL(mapped(QString)), this, SLOT(setText(QString)));
|
|
||||||
vlayout -> addLayout(buildRadioList());
|
|
||||||
|
|
||||||
potential_groupbox -> setLayout(vlayout);
|
|
||||||
mainlayout -> addWidget(potential_groupbox);
|
|
||||||
|
|
||||||
QDialogButtonBox *dbb = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Yes, Qt::Horizontal, this);
|
|
||||||
connect(dbb, SIGNAL(rejected()),
|
|
||||||
this, SLOT(reject()));
|
|
||||||
connect(dbb, SIGNAL(accepted()),
|
|
||||||
this, SLOT(accept()));
|
|
||||||
|
|
||||||
mainlayout->addWidget(dbb);
|
|
||||||
setLayout(mainlayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ConductorAutoNumerotationWidget::buildRadioList
|
|
||||||
*construit toute la partie de l'interface contenant les boutons radio permetant le choix du texte a appliquer
|
|
||||||
* @return un layout contenant les boutons radio
|
|
||||||
*/
|
|
||||||
QVBoxLayout* ConductorAutoNumerotationWidget::buildRadioList() {
|
|
||||||
QVBoxLayout *radioLayout = new QVBoxLayout;
|
|
||||||
QHBoxLayout *otherLayout = new QHBoxLayout;
|
|
||||||
|
|
||||||
//create a new radio button for each text of @conductorList
|
|
||||||
QMultiMap<int, QString> conductorlist = conductorsTextToMap(c_list);
|
|
||||||
for (QMultiMap<int, QString>::ConstIterator it = conductorlist.constEnd()-1; it != conductorlist.constBegin()-1; --it) {
|
|
||||||
QRadioButton *rb= new QRadioButton(it.value() + tr(" : est pr\351sent ") + QString::number(it.key()) + tr(" fois."), this);
|
|
||||||
if (it == conductorlist.constEnd()-1) {
|
|
||||||
rb -> setChecked(true);
|
|
||||||
text_ = it.value();
|
|
||||||
}
|
|
||||||
//connect the button to mapper @sm_
|
|
||||||
connect(rb, SIGNAL(clicked()),
|
|
||||||
sm_, SLOT(map()));
|
|
||||||
sm_ -> setMapping(rb, it.value());
|
|
||||||
radioLayout -> addWidget(rb);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create the "other" radio button and is text field
|
|
||||||
QRadioButton *other= new QRadioButton(tr("Autre"), this);
|
|
||||||
text_field = new QLineEdit(this);
|
|
||||||
text_field -> setEnabled(false);
|
|
||||||
connect(other, SIGNAL(toggled(bool)), text_field, SLOT(setEnabled(bool)));
|
|
||||||
otherLayout -> addWidget(other);
|
|
||||||
otherLayout -> addWidget(text_field);
|
|
||||||
radioLayout -> addLayout(otherLayout);
|
|
||||||
return radioLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param csl liste des conducteurs a analyser
|
|
||||||
* @return QMultiMap avec le nombre de conducteurs possedant le même texte en clee et le texte en question comme valeur
|
|
||||||
*/
|
|
||||||
QMultiMap <int, QString> ConductorAutoNumerotationWidget::conductorsTextToMap(QSet<Conductor *> csl) {
|
|
||||||
QStringList textList;
|
|
||||||
foreach(Conductor *c, csl) textList << c -> text();
|
|
||||||
|
|
||||||
QMultiMap<int, QString> conductorlist;
|
|
||||||
while (!textList.size() == 0) {
|
|
||||||
QString t = textList.at(0);
|
|
||||||
int n = textList.count(t);
|
|
||||||
textList.removeAll(t);
|
|
||||||
conductorlist.insert(n, t);
|
|
||||||
}
|
|
||||||
return conductorlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ConductorAutoNumerotationWidget::setText
|
|
||||||
* enregistre le texte @t passé en parametre
|
|
||||||
*/
|
|
||||||
void ConductorAutoNumerotationWidget::setText(QString t) {
|
|
||||||
text_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ConductorAutoNumerotationWidget::accept
|
|
||||||
*action executé lors de l'appuis sur le bouton 'oui'
|
|
||||||
*/
|
|
||||||
void ConductorAutoNumerotationWidget::accept() {
|
|
||||||
if (text_field -> isEnabled()) {
|
|
||||||
emit textIsSelected(text_field -> text());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
emit textIsSelected(text_);
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#ifndef CONDUCTORAUTONUMEROTATIONWIDGET_H
|
|
||||||
#define CONDUCTORAUTONUMEROTATIONWIDGET_H
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
#include <QSet>
|
|
||||||
#include <QMultiMap>
|
|
||||||
#include <QString>
|
|
||||||
#include "qetgraphicsitem/conductor.h"
|
|
||||||
#include "diagram.h"
|
|
||||||
|
|
||||||
class ConductorAutoNumerotationWidget : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ConductorAutoNumerotationWidget(QSet <Conductor *>, QWidget *parent = 0);
|
|
||||||
QMultiMap <int, QString> conductorsTextToMap (QSet <Conductor *>);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void setText (QString);
|
|
||||||
void accept();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void textIsSelected (QString);
|
|
||||||
|
|
||||||
private:
|
|
||||||
//methods
|
|
||||||
void buildInterface();
|
|
||||||
QVBoxLayout* buildRadioList();
|
|
||||||
|
|
||||||
//attributes
|
|
||||||
QSet<Conductor *> c_list; //liste des conducteurs au même potentiel
|
|
||||||
QLineEdit *text_field;
|
|
||||||
QString text_;
|
|
||||||
QSignalMapper *sm_;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CONDUCTORAUTONUMEROTATIONWIDGET_H
|
|
||||||
@@ -339,10 +339,15 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
border_and_titleblock.titleBlockToXml(racine);
|
border_and_titleblock.titleBlockToXml(racine);
|
||||||
border_and_titleblock.borderToXml(racine);
|
border_and_titleblock.borderToXml(racine);
|
||||||
|
|
||||||
// type de conducteur par defaut
|
// Default conductor properties
|
||||||
QDomElement default_conductor = document.createElement("defaultconductor");
|
QDomElement default_conductor = document.createElement("defaultconductor");
|
||||||
defaultConductorProperties.toXml(default_conductor);
|
defaultConductorProperties.toXml(default_conductor);
|
||||||
racine.appendChild(default_conductor);
|
racine.appendChild(default_conductor);
|
||||||
|
|
||||||
|
// Conductor autonum
|
||||||
|
if (!m_conductors_autonum_name.isEmpty()) {
|
||||||
|
racine.setAttribute("conductorAutonum", m_conductors_autonum_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
document.appendChild(racine);
|
document.appendChild(racine);
|
||||||
|
|
||||||
@@ -494,28 +499,34 @@ bool Diagram::initFromXml(QDomElement &document, QPointF position, bool consider
|
|||||||
*/
|
*/
|
||||||
bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_informations, DiagramContent *content_ptr) {
|
bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_informations, DiagramContent *content_ptr) {
|
||||||
QDomElement root = document;
|
QDomElement root = document;
|
||||||
// le premier element doit etre un schema
|
// The first element must be a diagram
|
||||||
if (root.tagName() != "diagram") return(false);
|
if (root.tagName() != "diagram") return(false);
|
||||||
|
|
||||||
// lecture des attributs de ce schema
|
// Read attributes of this diagram
|
||||||
if (consider_informations) {
|
if (consider_informations) {
|
||||||
|
// Version of diagram
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
qreal version_value = root.attribute("version").toDouble(&conv_ok);
|
qreal version_value = root.attribute("version").toDouble(&conv_ok);
|
||||||
if (conv_ok) {
|
if (conv_ok) {
|
||||||
diagram_qet_version_ = version_value;
|
diagram_qet_version_ = version_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load border and titleblock
|
||||||
border_and_titleblock.titleBlockFromXml(root);
|
border_and_titleblock.titleBlockFromXml(root);
|
||||||
border_and_titleblock.borderFromXml(root);
|
border_and_titleblock.borderFromXml(root);
|
||||||
|
|
||||||
// repere le permier element "defaultconductor"
|
// Find the element "defaultconductor".
|
||||||
|
// If found, load default conductor properties.
|
||||||
QDomElement default_conductor_elmt = root.firstChildElement("defaultconductor");
|
QDomElement default_conductor_elmt = root.firstChildElement("defaultconductor");
|
||||||
if (!default_conductor_elmt.isNull()) {
|
if (!default_conductor_elmt.isNull()) {
|
||||||
defaultConductorProperties.fromXml(default_conductor_elmt);
|
defaultConductorProperties.fromXml(default_conductor_elmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the autonum
|
||||||
|
m_conductors_autonum_name = root.attribute("conductorAutonum");
|
||||||
}
|
}
|
||||||
|
|
||||||
// si la racine n'a pas d'enfant : le chargement est fini (schema vide)
|
// if child haven't got a child, loading is finish (diagram is empty)
|
||||||
if (root.firstChild().isNull()) {
|
if (root.firstChild().isNull()) {
|
||||||
write(document);
|
write(document);
|
||||||
return(true);
|
return(true);
|
||||||
|
|||||||
104
sources/ui/potentialtextsdialog.cpp
Normal file
104
sources/ui/potentialtextsdialog.cpp
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2014 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>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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\351sent ") + 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;
|
||||||
|
}
|
||||||
61
sources/ui/potentialtextsdialog.h
Normal file
61
sources/ui/potentialtextsdialog.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2014 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
|
||||||
92
sources/ui/potentialtextsdialog.ui
Normal file
92
sources/ui/potentialtextsdialog.ui
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PotentialTextsDialog</class>
|
||||||
|
<widget class="QDialog" name="PotentialTextsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>94</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Textes de potentiel</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<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>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>PotentialTextsDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>PotentialTextsDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user