58 QGraphicsScene (project),
60 diagram_qet_version_ (-1),
63 draw_terminals_ (true),
64 draw_colored_conductors_ (true),
65 m_event_interface (nullptr),
66 m_freeze_new_elements (false),
67 m_freeze_new_conductors_ (false)
69 setItemIndexMethod(QGraphicsScene::NoIndex);
78 setBackgroundBrush(Qt::white);
82 QPen pen(Qt::NoBrush, 1.5, Qt::DashLine);
83 pen.setColor(Qt::black);
115 QList<QGraphicsItem *> deletable_items;
116 for(QGraphicsItem *qgi : items())
118 if (qgi -> parentItem())
continue;
119 if (qgraphicsitem_cast<Conductor *>(qgi))
continue;
120 deletable_items << qgi;
123 qDeleteAll (deletable_items);
135 p -> setRenderHint(QPainter::Antialiasing,
false);
136 p -> setRenderHint(QPainter::TextAntialiasing,
true);
137 p -> setRenderHint(QPainter::SmoothPixmapTransform,
false);
140 p -> setPen(Qt::NoPen);
150 pen.setCosmetic(
true);
153 p -> setBrush(Qt::NoBrush);
159 QRectF rect = settings.value(
"diagrameditor/zoom-out-beyond-of-folio",
false).toBool() ?
163 qreal limite_x = rect.x() + rect.width();
164 qreal limite_y = rect.y() + rect.height();
166 int g_x = (int)ceil(rect.x());
167 while (g_x %
xGrid) ++ g_x;
168 int g_y = (int)ceil(rect.y());
169 while (g_y %
yGrid) ++ g_y;
172 for (
int gx = g_x ; gx < limite_x ; gx +=
xGrid) {
173 for (
int gy = g_y ; gy < limite_y ; gy +=
yGrid) {
174 points << QPoint(gx, gy);
177 p -> drawPoints(points);
191 event->setAccepted(
false);
195 if (event->isAccepted()) {
200 QGraphicsScene::mouseDoubleClickEvent(event);
210 event->setAccepted(
false);
214 if (event->isAccepted()) {
219 QGraphicsScene::mousePressEvent(event);
229 event->setAccepted(
false);
233 if (event->isAccepted()) {
238 QGraphicsScene::mouseMoveEvent(event);
248 event->setAccepted(
false);
252 if (event->isAccepted()) {
257 QGraphicsScene::mouseReleaseEvent(event);
267 event->setAccepted(
false);
271 if (event->isAccepted()) {
276 QGraphicsScene::wheelEvent(event);
292 event->setAccepted(
false);
296 if (event->isAccepted()) {
304 qreal top_position = 0;
305 qreal left_position = 0;
310 if(event->modifiers() == Qt::NoModifier)
317 left_position = item->sceneBoundingRect().x();
318 if(left_position <= 5)
329 top_position = item->sceneBoundingRect().y();
330 if(top_position <= 5)
340 if (!movement.isNull() && !focusItem())
348 else if(event->modifiers() == Qt::AltModifier)
356 left_position = item->sceneBoundingRect().x();
357 if(left_position <= 5)
368 top_position = item->sceneBoundingRect().y();
369 if(top_position <= 5)
379 if (!movement.isNull() && !focusItem())
387 else if(event->modifiers() == Qt::ControlModifier)
390 if(selectedItems().size() == 1 && selectedItems().first()->type() == QGraphicsItemGroup::Type)
394 if(event->key() == Qt::Key_Left && etig->alignment() != Qt::AlignLeft)
397 else if (event->key() == Qt::Key_Up && etig->alignment() != Qt::AlignVCenter)
400 else if (event->key() == Qt::Key_Right && etig->alignment() != Qt::AlignRight)
408 QGraphicsScene::keyPressEvent(event);
420 e->setAccepted(
false);
424 if (e->isAccepted()) {
429 bool transmit_event =
true;
433 (e -> key() == Qt::Key_Left || e -> key() == Qt::Key_Right ||
434 e -> key() == Qt::Key_Up || e -> key() == Qt::Key_Down) &&
439 transmit_event =
false;
442 if (transmit_event) {
443 QGraphicsScene::keyReleaseEvent(e);
460 event_interface -> init();
508 source_area = itemsBoundingRect();
510 source_area.setWidth (source_area.width () + 2.0 *
margin);
511 source_area.setHeight(source_area.height() + 2.0 *
margin);
513 source_area = QRectF(
522 QSize image_size = (width == -1 && height == -1) ? source_area.size().toSize() : QSize(width, height);
526 if (!p.begin(&pix))
return(
false);
529 p.setRenderHint(QPainter::Antialiasing,
true);
530 p.setRenderHint(QPainter::TextAntialiasing,
true);
531 p.setRenderHint(QPainter::SmoothPixmapTransform,
true);
534 QList<QGraphicsItem *> selected_elmts = selectedItems();
535 foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(
false);
538 render(&p, QRect(QPoint(0, 0), image_size), source_area, aspectRatioMode);
542 foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(
true);
553 qreal image_width, image_height;
555 QRectF items_rect = itemsBoundingRect();
556 image_width = items_rect.width();
557 image_height = items_rect.height();
563 image_width += 2.0 *
margin;
564 image_height += 2.0 *
margin;
567 return(QSizeF(image_width, image_height).toSize());
575 return(!items().count());
584 QList < QSet <Conductor *> > potential_List;
589 QSet <Conductor *> one_potential = conductors_list.first() -> relatedPotentialConductors();
590 one_potential << conductors_list.takeFirst();
591 foreach (
Conductor *c, one_potential) conductors_list.removeOne(c);
592 potential_List << one_potential;
593 }
while (!conductors_list.empty());
595 return (potential_List);
606 QDomDocument document;
609 QDomElement racine = document.createElement(
"diagram");
620 QDomElement default_conductor = document.createElement(
"defaultconductor");
622 racine.appendChild(default_conductor);
637 QDomElement elmtfoliosequential = document.createElement(
"elementautonumfoliosequentials");
639 QDomElement elmtfolioseq = document.createElement(
"elementunitfolioseq");
641 elmtfoliosequential.appendChild(elmtfolioseq);
644 QDomElement elmtfolioseq = document.createElement(
"elementtenfolioseq");
646 elmtfoliosequential.appendChild(elmtfolioseq);
649 QDomElement elmtfolioseq = document.createElement(
"elementhundredfolioseq");
651 elmtfoliosequential.appendChild(elmtfolioseq);
653 racine.appendChild(elmtfoliosequential);
657 QDomElement cndfoliosequential = document.createElement(
"conductorautonumfoliosequentials");
658 QHash<QString, QStringList>::iterator i;
660 QDomElement cndfolioseq = document.createElement(
"conductorunitfolioseq");
662 cndfoliosequential.appendChild(cndfolioseq);
665 QDomElement cndfolioseq = document.createElement(
"conductortenfolioseq");
667 cndfoliosequential.appendChild(cndfolioseq);
670 QDomElement cndfolioseq = document.createElement(
"conductorhundredfolioseq");
672 cndfoliosequential.appendChild(cndfolioseq);
674 racine.appendChild(cndfoliosequential);
683 document.appendChild(racine);
686 if (items().
isEmpty())
return(document);
689 QList<Element *> list_elements;
690 QList<Conductor *> list_conductors;
691 QList<DiagramTextItem *> list_texts;
692 QList<DiagramImageItem *> list_images;
693 QList<QetShapeItem *> list_shapes;
695 QList<QGraphicsItem *> list_items = items();
698 foreach(QGraphicsItem *qgi, list_items) {
699 if (
Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
700 if (whole_content) list_elements << elmt;
701 else if (elmt -> isSelected()) list_elements << elmt;
702 }
else if (
Conductor *f = qgraphicsitem_cast<Conductor *>(qgi)) {
703 if (whole_content) list_conductors << f;
706 else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) {
707 list_conductors << f;
710 if (whole_content) list_texts << iti;
711 else if (iti -> isSelected()) list_texts << iti;
712 }
else if (
DiagramImageItem *dii = qgraphicsitem_cast<DiagramImageItem *>(qgi)) {
713 if (whole_content) list_images << dii;
714 else if (dii -> isSelected()) list_images << dii;
715 }
else if (
QetShapeItem *dsi = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
716 if (whole_content) list_shapes << dsi;
717 else if (dsi -> isSelected()) list_shapes << dsi;
722 QHash<Terminal *, int> table_adr_id;
725 if (!list_elements.isEmpty()) {
726 QDomElement
elements = document.createElement(
"elements");
727 foreach(
Element *elmt, list_elements) {
734 if (!list_conductors.isEmpty()) {
735 QDomElement
conductors = document.createElement(
"conductors");
736 foreach(
Conductor *cond, list_conductors) {
743 if (!list_texts.isEmpty()) {
744 QDomElement inputs = document.createElement(
"inputs");
746 inputs.appendChild(dti ->
toXml(document));
748 racine.appendChild(inputs);
752 if (!list_images.isEmpty()) {
753 QDomElement images = document.createElement(
"images");
755 images.appendChild(dii ->
toXml(document));
757 racine.appendChild(images);
761 if (!list_shapes.isEmpty()) {
762 QDomElement shapes = document.createElement(
"shapes");
764 shapes.appendChild(dii ->
toXml(document));
766 racine.appendChild(shapes);
779 void Diagram::folioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement,
const QString& seq_type,
const QString& type, QDomDocument *doc) {
780 QHash<QString, QStringList>::iterator i;
781 for (i = hash->begin(); i != hash->end(); i++) {
782 QDomElement folioseq = doc->createElement(type);
783 folioseq.setAttribute(
"title", i.key());
784 for (
int j = 0; j < i.value().size(); j++) {
785 folioseq.setAttribute(seq_type + QString::number(j+1), i.value().at(j));
787 domElement->appendChild(folioseq);
805 QDomElement root = document.documentElement();
806 return(
fromXml(root, position, consider_informations, content_ptr));
826 bool from_xml =
fromXml(document, position, consider_informations, content_ptr);
845 const QDomElement& root = document;
847 if (root.tagName() !=
"diagram")
return(
false);
850 if (consider_informations) {
853 qreal version_value = root.attribute(
"version").toDouble(&conv_ok);
864 QDomElement default_conductor_elmt = root.firstChildElement(
"defaultconductor");
865 if (!default_conductor_elmt.isNull()) {
890 if (root.firstChild().isNull()) {
900 bool handle_inputs_rotation = (
901 project_qet_version != -1 && project_qet_version < 0.3 &&
906 if (root.hasAttribute(
"projectId")) {
912 if (other_project && other_project !=
m_project) {
917 QString type_id = element_xml.attribute(
"type");
919 if (type_id.startsWith(
"embed://")) {
927 QList<Element *> added_elements;
928 QHash<int, Terminal *> table_adr_id;
934 QString type_id = element_xml.attribute(
"type");
936 if (type_id.startsWith(
"embed://")) {
947 QString debug_message = QString(
"Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.
path()).arg(state);
948 qDebug() << qPrintable(debug_message);
955 if (!nvel_elmt->
fromXml(element_xml, table_adr_id, handle_inputs_rotation))
959 qDebug() <<
"Diagram::fromXml() : Le chargement des parametres d'un element a echoue";
961 added_elements << nvel_elmt;
966 QList<IndependentTextItem *> added_texts;
975 QList<DiagramImageItem *> added_images;
984 QList<QetShapeItem *> added_shapes;
993 QList<Conductor *> added_conductors;
999 int id_p1 = f.attribute(
"terminal1").toInt();
1000 int id_p2 = f.attribute(
"terminal2").toInt();
1001 if (table_adr_id.contains(id_p1) && table_adr_id.contains(id_p2))
1003 Terminal *p1 = table_adr_id.value(id_p1);
1004 Terminal *p2 = table_adr_id.value(id_p2);
1012 added_conductors << c;
1018 else qDebug() <<
"Diagram::fromXml() : Le chargement du conducteur" << id_p1 << id_p2 <<
"a echoue";
1022 if (position != QPointF()) {
1024 QList<QGraphicsItem *> added_items;
1025 foreach (
Element *added_element, added_elements ) added_items << added_element;
1026 foreach (
Conductor *added_cond, added_conductors) added_items << added_cond;
1027 foreach (
QetShapeItem *added_shape, added_shapes ) added_items << added_shape;
1028 foreach (
DiagramTextItem *added_text, added_texts ) added_items << added_text;
1029 foreach (
DiagramImageItem *added_image, added_images ) added_items << added_image;
1033 foreach (QGraphicsItem *item, added_items) {
1034 items_rect = items_rect.united(item -> mapToScene(item -> boundingRect()).boundingRect());
1037 QPointF point_ = items_rect.topLeft();
1039 position.y() - point_.y()));
1042 foreach (QGraphicsItem *qgi, added_items)
1043 qgi -> setPos( qgi -> pos() += pos_);
1048 content_ptr -> m_elements = added_elements;
1049 content_ptr -> m_conductors_to_move = added_conductors;
1050 content_ptr -> m_text_fields = added_texts.toSet();
1051 content_ptr -> m_images = added_images.toSet();
1052 content_ptr -> m_shapes = added_shapes.toSet();
1067 void Diagram::folioSequentialsFromXml(
const QDomElement &root, QHash<QString, QStringList>* hash,
const QString& folioSeq,
const QString& seq,
const QString& type,
const QString& autonumFolioSeqType) {
1069 for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
1070 QString
title = folioseq.attribute(
"title");
1073 while (folioseq.hasAttribute(seq + QString::number(i))) {
1074 list << folioseq.attribute(seq + QString::number(i));
1077 hash->insert(
title,list);
1095 deti->refreshLabelConnection();
1099 conductor->refreshText();
1110 if (!item ||
isReadOnly() || item->scene() ==
this)
return;
1111 QGraphicsScene::addItem(item);
1113 switch (item->type())
1137 switch (item->type())
1155 QGraphicsScene::removeItem(item);
1203 if (template_name != current_name)
1211 if (items().
isEmpty())
return;
1214 foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(
true);
1215 blockSignals(
false);
1216 emit(selectionChanged());
1223 if (items().
isEmpty())
return;
1232 if (items().
isEmpty())
return;
1235 foreach (QGraphicsItem *item, items()) item -> setSelected(!item -> isSelected());
1236 blockSignals(
false);
1237 emit(selectionChanged());
1265 for (
int i = 0; i < nc->
size(); i++) {
1266 if (nc->
itemAt(i).at(0) == type) {
1268 max.append(QString::number(nc->
itemAt(i).at(3).toInt() - nc->
itemAt(i).at(2).toInt()));
1271 hash->insert(
title,max);
1286 for (
int i = 0; i < nc->
size(); i++) {
1287 if (nc->
itemAt(i).at(0) == type) {
1289 new_value = QString::number(hash->value(
title).at(j).toInt() + nc->
itemAt(i).at(2).toInt());
1303 QUndoCommand *undo =
new QUndoCommand(
tr(
"Modifier la profondeur"));
1308 QList<QGraphicsObject *> list;
1309 for(QGraphicsItem *item : l)
1310 list << item->toGraphicsObject();
1314 for(QGraphicsItem *item : this->items())
1316 qreal z = item->zValue();
1319 maxz = std::max(maxz,z);
1320 minz = std::min(minz,z);
1325 for(QGraphicsObject *qgo : list)
1331 for(QGraphicsObject *qgo : list)
1337 for(QGraphicsObject *qgo : list)
1342 for(QGraphicsObject *qgo : list)
1346 if(undo->childCount())
1424 if (formula.contains(
"%sequf_")) {
1431 if (formula.contains(
"%sequf_")) {
1440 if (formula.contains(
"%seqtf_")) {
1447 if (formula.contains(
"%seqtf_")) {
1456 if (formula.contains(
"%seqhf_")) {
1463 if (formula.contains(
"%seqhf_")) {
1478 QList<Element *> element_list;
1479 foreach (QGraphicsItem *qgi, items()) {
1480 if (
Element *elmt = qgraphicsitem_cast<Element *>(qgi))
1481 element_list <<elmt;
1483 return (element_list);
1491 QList<Conductor *> cnd_list;
1492 foreach (QGraphicsItem *qgi, items()) {
1493 if (
Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi))
1515 if (element -> location() == location) {
1599 QRectF old_rect = sceneRect();
1601 update(old_rect.united(sceneRect()));
1629 return(old_properties);
1644 return(diagram_position);
1656 if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier))
1658 int p_x = qRound(p.x());
1659 int p_y = qRound(p.y());
1660 return (QPointF(p_x, p_y));
1666 return (QPointF(p_x, p_y));
1676 foreach(QGraphicsItem *qgi, items()) {
1677 if (
Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
1678 t -> setVisible(dt);
1696 QSet<Conductor *> conductors_set;
1697 foreach(QGraphicsItem *qgi, selectedItems()) {
1698 if (
Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
1699 conductors_set << c;
1702 return(conductors_set);
1707 QString clipboard_text = QApplication::clipboard() -> text().trimmed();
1708 bool may_be_diagram = clipboard_text.startsWith(
"<diagram") && clipboard_text.endsWith(
"</diagram>");
1709 return(may_be_diagram);
1775 foreach(QGraphicsItem *qgi, items()) {
1776 if (
Element *e = qgraphicsitem_cast<Element *>(qgi)) {
1780 }
else if (
Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
1793 for (QGraphicsItem *qgi : selectedItems())
1802 if(qgi->type() == QGraphicsItemGroup::Type)
1803 if(dynamic_cast<ElementTextItemGroup *>(qgi))
virtual void keyPressEvent(QKeyEvent *event)
DiagramEventInterface::keyPressEvent By default, press escape key abort the curent action...
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
void setTitleBlockTemplate(const QString &)
QString conductorCurrentAutoNum() const
QETProject::conductorCurrentAutoNum.
static int yGrid
ordinate grid step size
void continueMovement(const QPointF &)
ElementsMover::continueMovement Add a move to the current movement.
bool importFromProject(QETProject *project, ElementsLocation &location)
ElementCollectionHandler::importFromProject Import the element represented by to the embedded collec...
void setDisplayGrid(bool)
void setProject(QETProject *)
Diagram::setProject Set parent project of this diagram, project also become the parent QObject of thi...
Send item one layer below their current one; zValues are decremented.
void changeZValue(QET::DepthOption option)
Diagram::changeZValue Change the Z value of the current selected item, according to ...
bool addConductor(Conductor *conductor)
Terminal::addConductor Add a conductor to this terminal.
QStringList itemAt(const int) const
NumerotationContext::itemAt.
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
DiagramPosition convertPosition(const QPointF &)
BorderTitleBlock::convertPosition Convert a Point in cartesian coordinate (x : 12.5, 56.9) to a point in grid coordinate (ex : B2)
Raise item one layer above their current one; zValues are incremented.
void insertFolioSeqHash(QHash< QString, QStringList > *hash, const QString &title, const QString &seq, NumerotationContext *nc)
Diagram::insertFolioSeqHash This class inserts a stringlist containing all sequential variables relat...
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
ElementTextsMover m_element_texts_mover
void adjustSceneRect()
Diagram::adjustSceneRect Recalcul and adjust the size of the scene.
void setConductorsAutonumName(const QString &name)
Diagram::setConductorsAutonumName.
QHash< QString, QStringList > m_cnd_unitfolio_max
Hash containing max values for folio sequential autonums in this diagram.
void folioSequentialsToXml(QHash< QString, QStringList > *, QDomElement *, const QString &, const QString &, QDomDocument *)
Diagram::folioSequentialsToXml.
static const qreal margin
margin around the diagram
QHash< QString, NumerotationContext > conductorAutoNum() const
QETProject::conductorAutoNum.
void setPosition(const QPointF &)
void diagramActivated()
Signal emitted when users wish to edit an element from the diagram.
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false...
bool m_freeze_new_elements
bool usesTitleBlockTemplate(const QString &)
bool draw_border
Whether to render the border (along with rows/columns headers)
QHash< QString, QStringList > m_cnd_hundredfolio_max
void titleChanged(const QString &)
QRectF insideBorderRect() const
BorderTitleBlock::insideBorderRect.
QSet< Conductor * > selectedConductors() const
QHash< QString, QStringList > m_cnd_tenfolio_max
void borderFromXml(const QDomElement &)
void toXml(QDomElement &) const
ConductorProperties::toXml Export conductor propertie, in the XML element 'e'.
bool borderIsDisplayed() const
QList< Conductor * > m_conductors_to_move
void setDrawTerminals(bool)
QHash< QString, QStringList > m_elmt_unitfolio_max
Hash containing max values for folio sequential autonums in this diagram.
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mouseMoveEvent This event is managed by diagram event interface if any.
static int yKeyGridFine
Key grid fine y step size.
bool isReadOnly() const
Diagram::isReadOnly.
QRectF borderAndTitleBlockRect() const
BorderTitleBlock::borderAndTitleBlockRect.
void freezeElements(bool freeze)
Diagram::freezeElements Freeze every existent element label.
void displayTitleBlock(bool)
QList< Conductor * > conductors() const
Diagram::conductors Return the list containing all conductors.
qreal diagram_qet_version_
Diagram(QETProject *project)
Diagram::Diagram Constructor.
static int projectId(const QETProject *)
static QETProject * project(const uint &)
void endMovement()
ElementsMover::endMovement Ended the current movement by creating an undo added to the undostack of t...
void fromXml(QDomElement &)
ConductorProperties::fromXml Import conductor propertie, from the attribute of the xml element 'e'...
Bring item to the foreground so they have the highest zValue.
QString numerotationContextToFormula(const NumerotationContext &nc)
numerotationContextToFormula
bool draw_colored_conductors_
void draw(QPainter *painter)
BorderTitleBlock::draw Draw the border and the titleblock.
static int xGrid
abscissa grid step size
QList< QSet< Conductor * > > potentials()
Diagram::potential.
bool drawTerminals() const
QDomDocument toXml(bool=true)
void usedTitleBlockTemplateChanged(const QString &)
QList< QGraphicsItem * > items(int=All) const
DiagramContent::items.
DiagramEventInterface * m_event_interface
QSet< IndependentTextItem * > m_text_fields
ElementsMover & elementsMover()
const QString version
QElectroTech version (as string, used to mark projects and elements XML documents) ...
ElementTextsMover & elementTextsMover()
void titleBlockTemplateChanged(const QString &)
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Réimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
bool draw_colored_conductors
Whether to render conductors colors.
int beginMovement(Diagram *, QGraphicsItem *=nullptr)
ElementsMover::beginMovement Start a new movement.
int size() const
NumerotationContext::size.
bool initFromXml(QDomElement &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
QString elementAutoNumCurrentFormula() const
QETProject::elementAutoNumCurrentFormula.
static int xKeyGridFine
Key grid fine x step size.
void borderToXml(QDomElement &)
void addConductorAutoNum(const QString &key, const NumerotationContext &context)
QETProject::addConductorAutoNum Add a new conductor numerotation context. If key already exist...
virtual bool fromXml(QDomElement &, QHash< int, Terminal *> &, bool=false)
Element::fromXml Import the parameters of this element from a xml document. When call this function e...
virtual void unlinkAllElements()
QString conductorsAutonumName() const
Diagram::conductorsAutonumName.
qreal declaredQElectroTechVersion(bool=true) const
Export the content of the diagram only.
bool freezeNewConductors()
Diagram::freezeNewConductors.
ExportProperties applyProperties(const ExportProperties &)
QList< QDomElement > findInDomElement(const QDomElement &, const QString &)
bool isValid() const
Conductor::isValid.
static bool valideXml(QDomElement &)
QGraphicsLineItem * conductor_setter_
bool toPaintDevice(QPaintDevice &, int=-1, int=-1, Qt::AspectRatioMode=Qt::KeepAspectRatio)
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mouseReleaseEvent This event is managed by diagram event interface if any.
TitleBlockTemplate * getTemplate(const QString &) override
DepthOption
List the various kind of changes for the zValue.
static int yKeyGrid
Key grid y step size.
void setEventInterface(DiagramEventInterface *event_interface)
Diagram::setEventInterface Set event_interface has current interface. Diagram become the ownership of...
DiagramContent content() const
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
DiagramPosition convertPosition(const QPointF &)
void updateLabels()
Diagram::updateLabels Update elements and conductors that reference folio field in their labels...
bool drawColoredConductors() const
void freezeConductors(bool freeze)
Diagram::freezeConductors Freeze every existent conductor label.
bool draw_titleblock
Whether to render the title block.
bool titleBlockIsDisplayed() const
void keyReleaseEvent(QKeyEvent *) override
Diagram::keyReleaseEvent This event is managed by diagram event interface if any. Else move selected ...
QList< Element * > m_elements
void keyPressEvent(QKeyEvent *event) override
Diagram::keyPressEvent This event is managed by diagram event interface if any. Else move selected el...
void titleBlockTemplateChanged(const QString &)
void setDrawColoredConductors(bool)
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
QString m_conductors_autonum_name
QString elementCurrentAutoNum() const
QETProject::elementCurrentAutoNum.
void calculateTextItemPosition()
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizont...
static QColor background_color
background color of diagram
void drawBackground(QPainter *, const QRectF &) override
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mouseDoubleClickEvent This event is managed by diagram event interface if any...
bool fromXml(QDomDocument &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
bool freezeNewElements()
Diagram::freezeNewElements.
QHash< QString, QStringList > m_elmt_hundredfolio_max
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void loadFolioSeqHash(QHash< QString, QStringList > *hash, const QString &title, const QString &seq, NumerotationContext *nc)
Diagram::loadFolioSeqHash This class loads all folio sequential variables related to the current auto...
bool m_freeze_new_conductors_
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
static bool valideXml(QDomElement &)
bool draw_grid
Whether to render the diagram grid.
void replaceValue(int, QString)
NumerotationContext::replaceValue This class replaces the current NC field value with content...
QGIManager * qgi_manager_
void titleBlockFromXml(const QDomElement &)
void removeConductor(Conductor *conductor)
Terminal::removeConductor Remove a conductor from this terminal.
QHash< QString, QStringList > m_elmt_tenfolio_max
QET::DiagramArea exported_area
Area of diagrams to be rendered.
static bool clipboardMayContainDiagram()
void unfreezeElements()
Diagram::unfreezeElements Unfreeze every existent element label.
void diagramTitleChanged(Diagram *, const QString &)
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
static int xKeyGrid
Key grid x step size.
void setFreezeNewElements(bool)
Diagram::freezeNewElements Set new element label to be frozen.
ElementsMover m_elements_mover
The DiagramEventInterface class isRunning() return true if action is running (do something). By default return false.
Send item to the background so they have the lowest zValue.
void loadCndFolioSeq()
Diagram::loadCndFolioSeq This class loads all conductor folio sequential variables related to the cur...
QList< Element * > elements() const
virtual void keyReleaseEvent(QKeyEvent *event)
void loadElmtFolioSeq()
Diagram::loadElmtFolioSeq This class loads all folio sequential variables related to the current auto...
void addElementAutoNum(const QString &key, const NumerotationContext &context)
QETProject::addElementAutoNum Add a new element numerotation context. If key already exist...
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void setFreezeNewConductors(bool)
Diagram::setfreezeNewConductors Set new conductor label to be frozen.
virtual void addItem(QGraphicsItem *item)
Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific ope...
~Diagram() override
Diagram::~Diagram Destructor.
void refreshContents()
Diagram::refreshContents refresh all content of diagram.
void clearEventInterface()
Diagram::clearEventInterface Clear the current event interface.
void freezeLabel(bool freeze)
Element::freezeLabel Freeze this element label.
void titleBlockToXml(QDomElement &)
QHash< QString, NumerotationContext > elementAutoNum() const
QETProject::elementAutoNum.
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
TitleBlockTemplatesProjectCollection * embeddedTitleBlockTemplatesCollection()
void titleBlockTemplateRemoved(const QString &, const QString &=QString())
QETProject * project() const
Export the diagram along with its border and title block.
void folioSequentialsFromXml(const QDomElement &, QHash< QString, QStringList > *, const QString &, const QString &, const QString &, const QString &)
Diagram::folioSequentialsFromXml Load folio sequential from QDomElement.
bool canRotateSelection() const
Diagram::canRotateSelection.
QList< Conductor * > conductors(int=AnyConductor) const
DiagramContent::conductors.
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
QString path() const
ElementsLocation::path.
ConductorProperties defaultConductorProperties
Default properties for new conductors.
bool draw_terminals
Whether to render terminals.
QString titleBlockTemplateName() const
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mousePressEvent This event is managed by diagram event interface if any. ...
static ElementFactory * Instance()
void wheelEvent(QGraphicsSceneWheelEvent *event) override
Diagram::wheelEvent This event is managed by diagram event interface if any.
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate *=nullptr)
The ElementCollectionHandler class Provide several method to copy element or directory from a collect...
bool usesElement(const ElementsLocation &)