Fix regression : Check conductors text when link two folios report.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4017 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun 2015-06-16 08:26:03 +00:00
parent e8eed16bfb
commit 9ba7b0c39d
5 changed files with 18 additions and 7 deletions

View File

@ -58,7 +58,7 @@ void ConductorAutoNumerotation::numerate() {
* @param conductor * @param conductor
* A conductor of the potential to check. * A conductor of the potential to check.
*/ */
void ConductorAutoNumerotation::checkPotential(Conductor *conductor) { void ConductorAutoNumerotation::checkPotential(Conductor *conductor, QUndoCommand *parent) {
//fill list of potential //fill list of potential
QSet <Conductor *> c_list = conductor->relatedPotentialConductors(); QSet <Conductor *> c_list = conductor->relatedPotentialConductors();
c_list << conductor; c_list << conductor;
@ -70,7 +70,7 @@ void ConductorAutoNumerotation::checkPotential(Conductor *conductor) {
if (!QET::eachStrIsEqual(strl)) { if (!QET::eachStrIsEqual(strl)) {
PotentialTextsDialog ptd(conductor, conductor->diagramEditor()); PotentialTextsDialog ptd(conductor, conductor->diagramEditor());
if ( ptd.exec() == QDialog::Accepted ) { if ( ptd.exec() == QDialog::Accepted ) {
ConductorAutoNumerotation can(conductor, conductor -> diagram()); ConductorAutoNumerotation can(conductor, conductor -> diagram(), parent);
can.applyText(ptd.selectedText()); can.applyText(ptd.selectedText());
} }
} }

View File

@ -32,7 +32,7 @@ class ConductorAutoNumerotation
//methods //methods
void numerate (); void numerate ();
static void checkPotential (Conductor *); static void checkPotential (Conductor *conductor, QUndoCommand *parent = nullptr);
void applyText (QString); void applyText (QString);
private: private:

View File

@ -190,8 +190,8 @@ bool LinkSingleElementWidget::setLiveEdit(bool live_edit)
void LinkSingleElementWidget::enableLiveEdit() void LinkSingleElementWidget::enableLiveEdit()
{ {
if (!esw_) return; if (!esw_) return;
connect(esw_, &ElementSelectorWidget::elementSelected, this, &LinkSingleElementWidget::apply); connect(esw_, &ElementSelectorWidget::elementSelected, this, &LinkSingleElementWidget::apply, Qt::QueuedConnection);
connect(ui->m_unlink_pb, &QPushButton::clicked, this, &LinkSingleElementWidget::apply); connect(ui->m_unlink_pb, &QPushButton::clicked, this, &LinkSingleElementWidget::apply, Qt::QueuedConnection);
} }
/** /**

View File

@ -18,6 +18,7 @@
#include "linkelementcommand.h" #include "linkelementcommand.h"
#include "element.h" #include "element.h"
#include "diagram.h" #include "diagram.h"
#include "conductorautonumerotation.h"
/** /**
* @brief LinkElementCommand::LinkElementCommand * @brief LinkElementCommand::LinkElementCommand
@ -27,7 +28,8 @@
*/ */
LinkElementCommand::LinkElementCommand(Element *element_, QUndoCommand *parent): LinkElementCommand::LinkElementCommand(Element *element_, QUndoCommand *parent):
QUndoCommand(parent), QUndoCommand(parent),
m_element(element_) m_element(element_),
m_first_redo (true)
{ {
m_linked_before = m_linked_after = m_element->linkedElements(); m_linked_before = m_linked_after = m_element->linkedElements();
setText(QObject::tr("Éditer les référence croisé", "edite the cross reference")); setText(QObject::tr("Éditer les référence croisé", "edite the cross reference"));
@ -40,7 +42,7 @@ LinkElementCommand::LinkElementCommand(Element *element_, QUndoCommand *parent):
*/ */
bool LinkElementCommand::mergeWith(const QUndoCommand *other) bool LinkElementCommand::mergeWith(const QUndoCommand *other)
{ {
if (id() != other->id()) return false; if (id() != other->id() || other->childCount()) return false;
LinkElementCommand const *undo = static_cast<const LinkElementCommand *> (other); LinkElementCommand const *undo = static_cast<const LinkElementCommand *> (other);
if (m_element != undo->m_element) return false; if (m_element != undo->m_element) return false;
m_linked_after = undo->m_linked_after; m_linked_after = undo->m_linked_after;
@ -204,6 +206,14 @@ void LinkElementCommand::redo()
{ {
if(m_element->diagram()) m_element->diagram()->showMe(); if(m_element->diagram()) m_element->diagram()->showMe();
makeLink(m_linked_after); makeLink(m_linked_after);
if (m_first_redo && (m_element->linkType() & Element::AllReport) \
&& m_element->conductors().size() \
&& m_linked_after.size() && m_linked_after.first()->conductors().size())
{
ConductorAutoNumerotation::checkPotential(m_element->conductors().first(), this);
m_first_redo = false;
}
QUndoCommand::redo(); QUndoCommand::redo();
} }

View File

@ -54,6 +54,7 @@ class LinkElementCommand : public QUndoCommand
private: private:
Element *m_element; Element *m_element;
bool m_first_redo;
QList<Element *> m_linked_before; //<Linked elements before this command, or when we call "undo" QList<Element *> m_linked_before; //<Linked elements before this command, or when we call "undo"
QList<Element *> m_linked_after; //<Linked elements after this command, or when we recall "redo" QList<Element *> m_linked_after; //<Linked elements after this command, or when we recall "redo"
}; };