Compare commits

..

5 Commits

Author SHA1 Message Date
joshua 3cf9095899 refactor[diagram editor] close bug.
Close bug report #324
https://qelectrotech.org/bugtracker/view.php?id=324

See commit #1b671990ee8435616725afdffba438fdfcd18069
2025-10-20 23:31:48 +02:00
joshua 3a1398d752 refactor[diagram editor]: remove unused include 2025-10-20 23:09:03 +02:00
joshua 67a7d277f4 refactor(diagram editor) : remove unused code 2025-10-20 23:02:52 +02:00
joshua e26f7fdaaa refactor[deiagram editor]: mutualize code.
The features used to jump to linked element and xref now use the same
function.
2025-10-20 22:58:12 +02:00
joshua f74fed9f3f refactor(diagram editor): remove unused checkbox
Remove the checkbox "export terminal in nomenclature" in the general
configuration page because it's a dead code.
2025-10-20 22:10:39 +02:00
8 changed files with 34 additions and 94 deletions
@@ -57,21 +57,9 @@ TerminalStripEditor::TerminalStripEditor(QETProject *project, QWidget *parent) :
{
if (m_model->columnTypeForIndex(index) == TerminalStripModel::XRef)
{
auto mrtd = m_model->modelRealTerminalDataForIndex(index);
if (mrtd.element_)
{
auto elmt = mrtd.element_;
auto diagram = elmt->diagram();
if (diagram)
{
diagram->showMe();
if (diagram->views().size())
{
auto fit_view = elmt->sceneBoundingRect();
fit_view.adjust(-200,-200,200,200);
diagram->views().at(0)->fitInView(fit_view, Qt::KeepAspectRatioByExpanding);
}
}
const auto mrtd = m_model->modelRealTerminalDataForIndex(index);
if (mrtd.element_) {
QetGraphicsItem::showItem(mrtd.element_);
}
}
});
+1 -18
View File
@@ -320,24 +320,7 @@ void CrossRefItem::paint(
void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
event->accept();
if (m_hovered_contact && m_hovered_contact->scene())
{
//Show and select the linked slave element
if (scene() != m_hovered_contact->scene())
{
m_hovered_contact->diagram()->showMe();
}
m_hovered_contact->setSelected(true);
//Zoom to the linked slave element
foreach(QGraphicsView *view,
m_hovered_contact->diagram()->views())
{
QRectF fit = m_hovered_contact->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view->fitInView(fit, Qt::KeepAspectRatioByExpanding);
}
}
QetGraphicsItem::showItem(m_hovered_contact);
}
/**
@@ -1278,17 +1278,7 @@ void DynamicElementTextItem::zoomToLinkedElement()
setSelected(false);
ungrabMouse();
if(scene() != zoomed_element->scene())
zoomed_element->diagram()->showMe();
zoomed_element->setSelected(true);
//Zoom to the element
for(QGraphicsView *view : zoomed_element->scene()->views())
{
QRectF fit = zoomed_element->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view->fitInView(fit, Qt::KeepAspectRatioByExpanding);
}
QetGraphicsItem::showItem(zoomed_element);
}
}
+1 -5
View File
@@ -18,8 +18,6 @@
#include "slaveelement.h"
#include "../diagram.h"
#include "../diagramposition.h"
#include "../qetapp.h"
#include "dynamicelementtextitem.h"
/**
@@ -33,9 +31,7 @@ SlaveElement::SlaveElement(const ElementsLocation &location,
QGraphicsItem *qgi,
int *state) :
Element(location, qgi, state, Element::Slave)
{
m_xref_item = nullptr;
}
{}
/**
@brief SlaveElement::~SlaveElement
-4
View File
@@ -18,7 +18,6 @@
#ifndef SLAVEELEMENT_H
#define SLAVEELEMENT_H
#include "../properties/xrefproperties.h"
#include "element.h"
class SlaveElement : public Element
@@ -33,9 +32,6 @@ class SlaveElement : public Element
void linkToElement(Element *elmt) override;
void unlinkAllElements() override;
void unlinkElement(Element *elmt) override;
private:
QGraphicsTextItem *m_xref_item;
};
#endif // SLAVEELEMENT_H
@@ -83,7 +83,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->m_use_gesture_trackpad->setChecked(settings.value("diagramview/gestures", false).toBool());
ui->m_save_label_paste->setChecked(settings.value("diagramcommands/erase-label-on-copy", true).toBool());
ui->m_use_folio_label->setChecked(settings.value("genericpanel/folio", true).toBool());
ui->m_export_terminal->setChecked(settings.value("nomenclature-exportlist", true).toBool());
ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
@@ -224,9 +223,6 @@ void GeneralConfigurationPage::applyConf()
//GENERIC PANEL
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
//NOMENCLATURE
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
//DIAGRAM EDITOR
QString view_mode = ui->m_use_tab_mode_rb->isChecked() ? "tabbed" : "windowed";
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>872</width>
<width>935</width>
<height>556</height>
</rect>
</property>
@@ -128,41 +128,21 @@
<string>Projets</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="1" column="0">
<widget class="QCheckBox" name="m_use_folio_label">
<property name="text">
<string>Utiliser les numéros de folio à la place de leur position dans le projet</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Sauvegarde automatique des projets (appliqué au prochain lancement de QElectroTech)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_save_label_paste">
<property name="text">
<string>Ne pas conserver les labels des éléments lors des copier coller</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="m_border_0">
<property name="text">
<string extracomment="Choix de l'increment de depart 1 ou 0">Numéroter les colonnes de cartouche à partir de 0 (1 sinon)</string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="3" column="2">
<widget class="QSpinBox" name="m_autosave_sb">
<property name="frame">
<bool>true</bool>
@@ -184,14 +164,14 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_use_folio_label">
<item row="0" column="0">
<widget class="QCheckBox" name="m_save_label_paste">
<property name="text">
<string>Utiliser les numéros de folio à la place de leur position dans le projet</string>
<string>Ne pas conserver les labels des éléments lors des copier coller</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -204,10 +184,23 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_export_terminal">
<widget class="QCheckBox" name="m_border_0">
<property name="text">
<string>Exporter les bornes dans la nomenclature</string>
<string extracomment="Choix de l'increment de depart 1 ou 0">Numéroter les colonnes de cartouche à partir de 0 (1 sinon)</string>
</property>
</widget>
</item>
@@ -1090,7 +1083,6 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
<tabstop>m_use_tab_mode_rb</tabstop>
<tabstop>m_save_label_paste</tabstop>
<tabstop>m_use_folio_label</tabstop>
<tabstop>m_export_terminal</tabstop>
<tabstop>m_border_0</tabstop>
<tabstop>m_autosave_sb</tabstop>
<tabstop>m_common_elmt_path_cb</tabstop>
@@ -146,7 +146,6 @@ void DynamicElementTextItemEditor::setCurrentText(DynamicElementTextItem *text)
return;
ui->m_tree_view->expand(index);
// ui->m_tree_view->expand(index.QModelIndex::model()->index(0,0)); // commented by plc-user: leads to crash, when other textitem was selected before
ui->m_tree_view->setCurrentIndex(index);
ui->m_remove_selection->setEnabled(true);
}