mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
multi past dialog : add check box for autonum the pasted element
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5333 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -139,6 +139,17 @@ namespace autonum
|
|||||||
hundred_folio = from.text().split(";");
|
hundred_folio = from.text().split(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Clear this sequence
|
||||||
|
void sequentialNumbers::clear()
|
||||||
|
{
|
||||||
|
unit.clear();
|
||||||
|
unit_folio.clear();
|
||||||
|
ten.clear();
|
||||||
|
ten_folio.clear();
|
||||||
|
hundred.clear();
|
||||||
|
hundred_folio.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief AssignVariables::formulaToLabel
|
* @brief AssignVariables::formulaToLabel
|
||||||
* Return the @formula with variable assigned (ready to be displayed)
|
* Return the @formula with variable assigned (ready to be displayed)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace autonum
|
|||||||
|
|
||||||
QDomElement toXml(QDomDocument &document, QString tag_name = QString("sequentialNumbers")) const;
|
QDomElement toXml(QDomDocument &document, QString tag_name = QString("sequentialNumbers")) const;
|
||||||
void fromXml(const QDomElement &element);
|
void fromXml(const QDomElement &element);
|
||||||
|
void clear();
|
||||||
|
|
||||||
QStringList unit;
|
QStringList unit;
|
||||||
QStringList unit_folio;
|
QStringList unit_folio;
|
||||||
|
|||||||
@@ -1182,6 +1182,7 @@ void Element::setUpFormula(bool code_letter)
|
|||||||
NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
|
NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
|
||||||
NumerotationContextCommands ncc (nc);
|
NumerotationContextCommands ncc (nc);
|
||||||
|
|
||||||
|
m_autoNum_seq.clear();
|
||||||
autonum::setSequential(formula, m_autoNum_seq, nc, diagram(), element_currentAutoNum);
|
autonum::setSequential(formula, m_autoNum_seq, nc, diagram(), element_currentAutoNum);
|
||||||
diagram()->project()->addElementAutoNum(element_currentAutoNum, ncc.next());
|
diagram()->project()->addElementAutoNum(element_currentAutoNum, ncc.next());
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
|
|||||||
QUndoCommand *undo = new QUndoCommand(tr("Multi-collage"));
|
QUndoCommand *undo = new QUndoCommand(tr("Multi-collage"));
|
||||||
new PasteDiagramCommand(m_diagram, m_pasted_content, undo);
|
new PasteDiagramCommand(m_diagram, m_pasted_content, undo);
|
||||||
|
|
||||||
|
//Auto-connection
|
||||||
if(ui->m_auto_connection_cb->isChecked())
|
if(ui->m_auto_connection_cb->isChecked())
|
||||||
{
|
{
|
||||||
for(Element *elmt : m_pasted_content.m_elements)
|
for(Element *elmt : m_pasted_content.m_elements)
|
||||||
@@ -102,6 +103,33 @@ void MultiPasteDialog::on_m_button_box_accepted()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_diagram->undoStack().push(undo);
|
m_diagram->undoStack().push(undo);
|
||||||
|
|
||||||
|
//Set up the label of element
|
||||||
|
//Instead of use the current autonum of project,
|
||||||
|
//we try to fetch the same formula of the pasted element, in the several autonum of the project
|
||||||
|
//for apply the good formula for each elements
|
||||||
|
if(ui->m_auto_num_cb->isChecked())
|
||||||
|
{
|
||||||
|
for(Element *elmt : m_pasted_content.m_elements)
|
||||||
|
{
|
||||||
|
QString formula = elmt->elementInformations()["formula"].toString();
|
||||||
|
if(!formula.isEmpty())
|
||||||
|
{
|
||||||
|
QHash <QString, NumerotationContext> autonums = m_diagram->project()->elementAutoNum();
|
||||||
|
QHashIterator<QString, NumerotationContext> hash_iterator(autonums);
|
||||||
|
|
||||||
|
while(hash_iterator.hasNext())
|
||||||
|
{
|
||||||
|
hash_iterator.next();
|
||||||
|
if(autonum::numerotationContextToFormula(hash_iterator.value()) == formula)
|
||||||
|
{
|
||||||
|
m_diagram->project()->setCurrrentElementAutonum(hash_iterator.key());
|
||||||
|
elmt->setUpFormula();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
m_diagram->adjustSceneRect();
|
m_diagram->adjustSceneRect();
|
||||||
m_accept = true;
|
m_accept = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>261</width>
|
<width>261</width>
|
||||||
<height>110</height>
|
<height>136</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -94,6 +94,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="m_auto_num_cb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto-numérotation des éléments (experimental)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
Reference in New Issue
Block a user