19 #include "ui_multipastedialog.h" 38 for (QGraphicsItem *item :
m_diagram->selectedItems())
39 br =
br.united(item->mapToScene(item->boundingRect()).boundingRect());
52 if(item->scene() && item->scene() ==
m_diagram)
68 if(item->scene() && item->scene() ==
m_diagram)
77 QPointF offset(
ui->m_x_sb->value(),
ui->m_y_sb->value());
80 for(
int i=0 ; i<
ui->m_copy_count->value() ; i++)
101 bool erase_label = settings.value(
"diagramcommands/erase-label-on-copy",
true).toBool();
106 if(
ui->m_auto_num_cb->isChecked())
107 settings.setValue(
"diagramcommands/erase-label-on-copy",
false);
116 QList<Element *> pasted_elements = dc.m_elements;
118 std::sort(pasted_elements.begin(), pasted_elements.end(), [](
Element *a,
Element *b){
return (a->pos().y() < b->pos().y());});
121 if(
ui->m_auto_connection_cb->isChecked())
123 for(
Element *elmt : pasted_elements)
125 while (!elmt->AlignedFreeTerminals().isEmpty())
127 QPair <Terminal *, Terminal *> pair = elmt->AlignedFreeTerminals().takeFirst();
146 if(
ui->m_auto_num_cb->isChecked())
148 for(
Element *elmt : pasted_elements)
150 QString formula = elmt->elementInformations()[
"formula"].toString();
151 if(!formula.isEmpty())
154 QHashIterator<QString, NumerotationContext> hash_iterator(autonums);
156 while(hash_iterator.hasNext())
158 hash_iterator.next();
162 elmt->setUpFormula();
169 if(
ui->m_auto_num_cond_cb->isChecked())
172 QList<Conductor *> numerated;
174 for(
Element *elmt : pasted_elements)
178 if(numerated.contains(c))
182 QString formula = c->properties().m_formula;
183 if(!formula.isEmpty())
186 QHashIterator <QString, NumerotationContext> hash_iterator(autonums);
188 while (hash_iterator.hasNext())
190 hash_iterator.next();
194 c->rSequenceNum().clear();
199 c->setFreezeLabel(
true);
211 settings.setValue(
"diagramcommands/erase-label-on-copy", erase_label);
void adjustSceneRect()
Diagram::adjustSceneRect Recalcul and adjust the size of the scene.
QHash< QString, NumerotationContext > conductorAutoNum() const
QETProject::conductorAutoNum.
bool isFreezeNewConductors()
QETProject::isFreezeNewConductors.
void setCurrrentElementAutonum(QString autoNum)
QETProject::setCurrrentElementAutonum.
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false...
The AddItemCommand class This command add an item in a diagram The item to add is template...
void setCurrentConductorAutoNum(QString autoNum)
QETProject::setCurrentConductorAutoNum.
QString numerotationContextToFormula(const NumerotationContext &nc)
numerotationContextToFormula
QDomDocument toXml(bool=true)
MultiPasteDialog(Diagram *diagram, QWidget *parent=nullptr)
QList< QGraphicsItem * > items(int=All) const
DiagramContent::items.
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Réimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
Ui::MultiPasteDialog * ui
void numerate()
ConductorAutoNumerotation::numerate execute the automatic numerotation.
bool freezeNewConductors()
Diagram::freezeNewConductors.
DiagramContent m_pasted_content
void on_m_button_box_accepted()
bool fromXml(QDomDocument &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
QList< DiagramContent > m_pasted_content_list
void clear()
DiagramContent::clear Remove all items from the diagram content.
QHash< QString, NumerotationContext > elementAutoNum() const
QETProject::elementAutoNum.
QETProject * project() const
int count(int=All) const
DiagramContent::count.