mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 09:40:52 +01:00
Conductor auto numerotation : use function from QET namespace instead of function from this file.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3532 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "conductor.h"
|
||||
#include "diagram.h"
|
||||
#include "potentialtextsdialog.h"
|
||||
#include "qet.h"
|
||||
|
||||
/**
|
||||
*Constructor
|
||||
@@ -51,15 +52,15 @@ void ConductorAutoNumerotation::numerate() {
|
||||
* A conductor of the potential to check.
|
||||
*/
|
||||
void ConductorAutoNumerotation::checkPotential(Conductor *conductor) {
|
||||
//fill list of potential
|
||||
//fill list of potential
|
||||
QSet <Conductor *> c_list = conductor->relatedPotentialConductors();
|
||||
c_list << conductor;
|
||||
//fill list of text
|
||||
//fill list of text
|
||||
QStringList strl;
|
||||
foreach (const Conductor *c, c_list) strl<<(c->text());
|
||||
|
||||
//check text list, isn't same in potential, ask user what to do
|
||||
if (!eachIsEqual(strl)) {
|
||||
//check text list, isn't same in potential, ask user what to do
|
||||
if (!QET::eachStrIsEqual(strl)) {
|
||||
PotentialTextsDialog ptd(conductor, conductor->diagramEditor());
|
||||
if ( ptd.exec() == QDialog::Accepted ) {
|
||||
ConductorAutoNumerotation can(conductor);
|
||||
@@ -110,8 +111,8 @@ void ConductorAutoNumerotation::applyText(QString t) {
|
||||
void ConductorAutoNumerotation::numeratePotential() {
|
||||
QStringList strl;
|
||||
foreach (const Conductor *cc, conductor_list) strl<<(cc->text());
|
||||
//the texts is identicals
|
||||
if (eachIsEqual(strl)) {
|
||||
//the texts is identicals
|
||||
if (QET::eachStrIsEqual(strl)) {
|
||||
ConductorProperties cp = conductor_ -> properties();
|
||||
cp.text = strl.at(0);
|
||||
conductor_ -> setProperties(cp);
|
||||
@@ -140,13 +141,3 @@ void ConductorAutoNumerotation::numerateNewConductor() {
|
||||
applyText(ncc.toRepresentedString());
|
||||
m_diagram->project()->addConductorAutoNum(m_diagram -> conductorsAutonumName(), ncc.next());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if every text of qsl is identical, else false.
|
||||
*/
|
||||
bool eachIsEqual (const QStringList &qsl) {
|
||||
foreach (const QString t, qsl) {
|
||||
if (qsl.at(0) != t) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,4 @@ class ConductorAutoNumerotation {
|
||||
QSet <Conductor *> conductor_list;
|
||||
};
|
||||
|
||||
bool eachIsEqual (const QStringList &);
|
||||
|
||||
#endif // CONDUCTORAUTONUMEROTATION_H
|
||||
|
||||
Reference in New Issue
Block a user