Merge branch 'master' into master

This commit is contained in:
Kellermorph
2026-03-31 14:14:02 +02:00
committed by GitHub
9 changed files with 56 additions and 104 deletions

View File

@@ -15,10 +15,10 @@ The main goal of the developers is to provide a libre, easy to use and effective
### Version
The current stable version is 0.90 and was released on 2023.01.06.
The current stable version is 0.100 and was released on 2026.01.25.
Once it has been officially released, the stable version is always frozen and is no longer developed.
New functionalities, bug and issue fixings are further made in the development version (currently 0.100), which can also be [downloaded](https://qelectrotech.org/download.php).
New functionalities, bug and issue fixings are further made in the development version (currently 0.100.1 or 0.200.0 if based on new Qt6 port), which can also be [downloaded](https://qelectrotech.org/download.php).
Users who want to test and take benefits from the last software implementations should use the development version. But... use it at your own risk, since things are sometimes broken or only partially implemented until they are done!

View File

@@ -1,4 +1,4 @@
/*
/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
@@ -96,18 +96,8 @@ void ElementPropertiesEditorWidget::upDateInterface()
}
else if (m_data.m_type == ElementData::Master) {
ui->m_master_type_cb->setCurrentIndex(
ui->m_master_type_cb->findData (
m_data.m_master_type));
// NEU: Checkbox und Zahlenbox für max_slaves einstellen
if (m_data.m_max_slaves == -1) {
ui->max_slaves_checkbox->setChecked(false);
ui->max_slaves_spinbox->setEnabled(false);
} else {
ui->max_slaves_checkbox->setChecked(true);
ui->max_slaves_spinbox->setEnabled(true);
ui->max_slaves_spinbox->setValue(m_data.m_max_slaves);
}
ui->m_master_type_cb->findData (
m_data.m_master_type));
} else if (m_data.m_type == ElementData::Terminal) {
ui->m_terminal_type_cb->setCurrentIndex(
ui->m_terminal_type_cb->findData(
@@ -161,14 +151,17 @@ void ElementPropertiesEditorWidget::setUpInterface()
ui->m_terminal_func_cb->addItem(tr("Phase"), ElementData::TFPhase);
ui->m_terminal_func_cb->addItem(tr("Neutre"), ElementData::TFNeutral);
//Disable the edition of the first column of the information tree
//by this little workaround
ui->m_tree->setItemDelegate(new EditorDelegate(this));
//Disable the edition of the first column of the information tree
//by this little workaround
//Disable the edition of the first column of the information tree
//by this little workaround
ui->m_tree->setItemDelegate(new EditorDelegate(this));
ui->m_tree->header()->resizeSection(0, 150);
// NEU: Checkbox mit der Zahlenbox verbinden (Aktivieren/Deaktivieren)
connect(ui->max_slaves_checkbox, SIGNAL(toggled(bool)), ui->max_slaves_spinbox, SLOT(setEnabled(bool)));
// NEU: Checkbox mit der Zahlenbox verbinden (Aktivieren/Deaktivieren)
connect(ui->max_slaves_checkbox, SIGNAL(toggled(bool)), ui->max_slaves_spinbox, SLOT(setEnabled(bool)));
populateTree();
populateTree();
}
void ElementPropertiesEditorWidget::updateTree()
@@ -239,13 +232,6 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted()
}
else if (m_data.m_type == ElementData::Master) {
m_data.m_master_type = ui->m_master_type_cb->currentData().value<ElementData::MasterType>();
// NEU: Wenn Häkchen gesetzt, speichere die Zahl, ansonsten -1 (unendlich)
if (ui->max_slaves_checkbox->isChecked()) {
m_data.m_max_slaves = ui->max_slaves_spinbox->value();
} else {
m_data.m_max_slaves = -1;
}
}
else if (m_data.m_type == ElementData::Terminal)
{

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>527</width>
<height>492</height>
<height>442</height>
</rect>
</property>
<property name="windowTitle">
@@ -104,23 +104,6 @@
<item row="0" column="1">
<widget class="QComboBox" name="m_master_type_cb"/>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="max_slaves_checkbox">
<property name="text">
<string>max. Slaves definieren</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="max_slaves_spinbox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -568,12 +568,9 @@ void ElementData::kindInfoFromXml(const QDomElement &xml_element)
}
auto name = dom_elmt.attribute(QStringLiteral("name"));
if (m_type == ElementData::Master) {
if (name == QLatin1String("type")) {
m_master_type = masterTypeFromString(dom_elmt.text());
} else if (name == QLatin1String("max_slaves")) {
m_max_slaves = dom_elmt.text().toInt();
}
if (m_type == ElementData::Master &&
name == QLatin1String("type")) {
m_master_type = masterTypeFromString(dom_elmt.text());
}
else if (m_type == ElementData::Slave ) {
if (name == QLatin1String("type")) {

View File

@@ -134,7 +134,10 @@ class ElementData : public PropertiesInterface
ElementData::Type m_type = ElementData::Simple;
ElementData::MasterType m_master_type = ElementData::Coil;
<<<<<<< master
int m_max_slaves{-1};
=======
>>>>>>> master
ElementData::SlaveType m_slave_type = ElementData::SSimple;
ElementData::SlaveState m_slave_state = ElementData::NO;

View File

@@ -181,7 +181,7 @@ void MasterElement::aboutDeleteXref()
delete m_Xref_item;
m_Xref_item = nullptr;
return;
}
}
}
/**
@@ -190,20 +190,20 @@ void MasterElement::aboutDeleteXref()
*/
bool MasterElement::isFull() const
{
// Set default value to -1 (unlimited slaves)
int max_slaves = -1;
QVariant max_slaves_variant = kindInformations().value("max_slaves");
// Set default value to -1 (unlimited slaves)
int max_slaves = -1;
QVariant max_slaves_variant = kindInformations().value("max_slaves");
// Overwrite default if a valid limit is defined in the element's XML
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
max_slaves = max_slaves_variant.toInt();
}
// Overwrite default if a valid limit is defined in the element's XML
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
max_slaves = max_slaves_variant.toInt();
}
// If no limit is set (-1), the master is never full
if (max_slaves == -1) {
return false;
}
// If no limit is set (-1), the master is never full
if (max_slaves == -1) {
return false;
}
// Return true if current connected elements reached or exceeded the limit
return connected_elements.size() >= max_slaves;
// Return true if current connected elements reached or exceeded the limit
return connected_elements.size() >= max_slaves;
}

View File

@@ -44,8 +44,6 @@ class MasterElement : public Element
void unlinkElement (Element *elmt) override;
void initLink (QETProject *project) override;
QRectF XrefBoundingRect() const;
bool isFull() const; // NEU: Prüft, ob das Slave-Limit erreicht ist
protected:
QVariant itemChange(

View File

@@ -16,7 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "linksingleelementwidget.h"
#include "../qetgraphicsitem/masterelement.h"
#include "../qetgraphicsitem/conductor.h"
#include "../diagram.h"
#include "../diagramposition.h"
@@ -386,22 +386,7 @@ QVector <QPointer<Element>> LinkSingleElementWidget::availableElements()
//If element is linked, remove is parent from the list
if(!m_element->isFree()) elmt_vector.removeAll(m_element->linkedElements().first());
// NEU: Filtere volle Master-Elemente aus der Liste heraus
for (int i = elmt_vector.size() - 1; i >= 0; --i) {
Element *elmt = elmt_vector.at(i);
// Wenn das Element in der Liste ein Master ist
if (elmt->linkType() == Element::Master) {
// Wir wandeln den generischen Element-Pointer in einen MasterElement-Pointer um
MasterElement *master = static_cast<MasterElement*>(elmt);
// Wenn der Master voll ist, werfen wir ihn aus der Liste!
if (master->isFull()) {
elmt_vector.removeAt(i);
}
}
}
return elmt_vector;
}

View File

@@ -342,7 +342,7 @@ void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
{
m_context_menu->clear();
m_context_menu->addAction(m_save_header_state);
m_context_menu->popup(ui->m_free_tree_widget->header()->mapToGlobal(pos));
m_context_menu->popup(ui->m_free_tree_widget->header()->mapToGlobal(pos));
}
/**
@@ -352,33 +352,33 @@ void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
*/
void MasterPropertiesWidget::on_link_button_clicked()
{
// Get the maximum number of allowed slaves from the element's information
QVariant max_slaves_variant = m_element->kindInformations().value("max_slaves");
// Get the maximum number of allowed slaves from the element's information
QVariant max_slaves_variant = m_element->kindInformations().value("max_slaves");
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
int max_slaves = max_slaves_variant.toInt();
int current_slaves = ui->m_link_tree_widget->topLevelItemCount();
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
int max_slaves = max_slaves_variant.toInt();
int current_slaves = ui->m_link_tree_widget->topLevelItemCount();
// If a limit is set and reached
if (max_slaves != -1 && current_slaves >= max_slaves) {
// If a limit is set and reached
if (max_slaves != -1 && current_slaves >= max_slaves) {
// Show a message box with the actual window as parent to ensure it's on top
QMessageBox::warning(this->window(),
tr("Maximum Slaves Reached"),
tr("This master element cannot accept any new slaves because it is full (Limit: %1).").arg(max_slaves));
return;
}
}
// Show a message box with the actual window as parent to ensure it's on top
QMessageBox::warning(this->window(),
tr("Maximum Slaves Reached"),
tr("This master element cannot accept any new slaves because it is full (Limit: %1).").arg(max_slaves));
return;
}
}
// Move current item from free_list to linked_list
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
// Move current item from free_list to linked_list
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
if (qtwi)
{
ui->m_free_tree_widget->takeTopLevelItem(
ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
if(m_live_edit)
apply();
}