QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
masterpropertieswidget.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef MASTERPROPERTIESWIDGET_H
19#define MASTERPROPERTIESWIDGET_H
20
21#include <QWidget>
22#include <QHash>
23#include <QMap>
24
26
27class Element;
28class QUndoCommand;
29class QETProject;
30class Diagram;
31class QTreeWidgetItem;
32class QMenu;
33class QAction;
34class QTableWidget;
35class QSpinBox;
36class QCheckBox;
37class QComboBox;
38
39namespace Ui {
40 class MasterPropertiesWidget;
41}
42
50{
51 Q_OBJECT
52
53 public:
54 explicit MasterPropertiesWidget(Element *elmt,
55 QWidget *parent = nullptr);
56 ~MasterPropertiesWidget() override;
57
58 void setElement (Element *element) override;
59 void apply() override;
60 void reset() override;
61 QUndoCommand *associatedUndo () const override;
66 QString title() const override {
67 return tr("Référence croisée (maître)");}
68 bool setLiveEdit(bool live_edit) override;
69
70 public slots:
71 void updateUi() override;
72
73 private slots:
74 void headerCustomContextMenuRequested(const QPoint &pos);
77 void showElementFromTWI(QTreeWidgetItem *qtwi, int column);
80 void customContextMenu(const QPoint &pos, int i=0);
81
82 // PLC IO table slots
84 void setCellFromValue(int row, int col, const QString &val);
85 void plcAddRow();
86 void plcRemoveRow();
87 void plcMoveRowUp();
88 void plcMoveRowDown();
89 void plcIOCellChanged(int row, int column);
91 void plcShowTableContextMenu(const QPoint &pos);
92
93 private:
94 Ui::MasterPropertiesWidget *ui;
95 QHash <QTreeWidgetItem *, Element *> m_qtwi_hash;
96 QMap <Element *, int> m_pending_group_indices;
97 QTreeWidgetItem *m_qtwi_at_context_menu = nullptr;
98 QPointer <Element> m_showed_element;
106
107 // PLC-specific members
108 QWidget *m_plc_widget = nullptr;
109 QTableWidget *m_plc_table = nullptr;
110 QCheckBox *m_plc_break_checkboxes[4] = {nullptr, nullptr, nullptr, nullptr};
111 QSpinBox *m_plc_break_spinboxes[4] = {nullptr, nullptr, nullptr, nullptr};
112 QSpinBox *m_plc_row_height_spinbox = nullptr;
114 QList<QSpinBox *> m_plc_col_width_spinboxes;
115 bool m_plc_updating = false; // Guard against recursive updates
116};
117
118#endif // MASTERPROPERTIESWIDGET_H
AbstractElementPropertiesEditorWidget(QWidget *parent=nullptr)
Definition abstractelementpropertieseditorwidget.cpp:20
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:54
Definition element.h:44
QList< QCheckBox * > m_plc_col_visibility_checkboxes
Definition masterpropertieswidget.h:113
QAction * m_show_qtwi
Definition masterpropertieswidget.h:103
QTreeWidgetItem * m_qtwi_at_context_menu
Definition masterpropertieswidget.h:97
QList< QSpinBox * > m_plc_col_width_spinboxes
Definition masterpropertieswidget.h:114
QAction * m_unlink_action
Definition masterpropertieswidget.h:102
QCheckBox * m_plc_break_checkboxes[4]
Definition masterpropertieswidget.h:110
void reset() override
MasterPropertiesWidget::reset Reset current widget, clear eveything and rebuild widget.
Definition masterpropertieswidget.cpp:199
bool setLiveEdit(bool live_edit) override
MasterPropertiesWidget::setLiveEdit.
Definition masterpropertieswidget.cpp:277
QSpinBox * m_plc_break_spinboxes[4]
Definition masterpropertieswidget.h:111
QPointer< Element > m_showed_element
Definition masterpropertieswidget.h:98
void plcIOCellChanged(int row, int column)
MasterPropertiesWidget::plcIOCellChanged Called when a cell in the PLC IO table changes.
Definition masterpropertieswidget.cpp:955
void plcPasteFromClipboard()
MasterPropertiesWidget::plcPasteFromClipboard Paste IO data from clipboard.
Definition masterpropertieswidget.cpp:725
QUndoCommand * associatedUndo() const override
MasterPropertiesWidget::associatedUndo If link between the edited element and other change,...
Definition masterpropertieswidget.cpp:215
void showedElementWasDeleted()
MasterPropertiesWidget::showedElementWasDeleted Set to nullptr the current showed element when he was...
Definition masterpropertieswidget.cpp:414
QAction * m_show_element
Definition masterpropertieswidget.h:104
QAction * m_save_header_state
Definition masterpropertieswidget.h:105
QString title() const override
title
Definition masterpropertieswidget.h:66
MasterPropertiesWidget(Element *elmt, QWidget *parent=nullptr)
MasterPropertiesWidget::MasterPropertiesWidget Default constructor.
Definition masterpropertieswidget.cpp:50
void on_link_button_clicked()
MasterPropertiesWidget::on_link_button_clicked Moves the current item from the free_list to the linke...
Definition masterpropertieswidget.cpp:301
void plcRemoveRow()
MasterPropertiesWidget::plcRemoveRow Remove selected rows from the PLC IO table.
Definition masterpropertieswidget.cpp:862
void on_unlink_button_clicked()
MasterPropertiesWidget::on_unlink_button_clicked move current item in linked_list to free_list.
Definition masterpropertieswidget.cpp:372
void headerCustomContextMenuRequested(const QPoint &pos)
MasterPropertiesWidget::headerCustomContextMenuRequested.
Definition masterpropertieswidget.cpp:289
QWidget * m_plc_widget
Definition masterpropertieswidget.h:108
QAction * m_link_action
Definition masterpropertieswidget.h:101
void setElement(Element *element) override
MasterPropertiesWidget::setElement Set the element to be edited.
Definition masterpropertieswidget.cpp:143
void updateUi() override
MasterPropertiesWidget::updateUi Build the interface of the widget.
Definition masterpropertieswidget.cpp:483
void diagramWasdeletedFromProject()
MasterPropertiesWidget::diagramWasdeletedFromProject This slot is called when a diagram is removed fr...
Definition masterpropertieswidget.cpp:424
QMenu * m_context_menu
Definition masterpropertieswidget.h:100
QTableWidget * m_plc_table
Definition masterpropertieswidget.h:109
~MasterPropertiesWidget() override
MasterPropertiesWidget::~MasterPropertiesWidget Destructor.
Definition masterpropertieswidget.cpp:127
bool m_plc_updating
Definition masterpropertieswidget.h:115
Ui::MasterPropertiesWidget * ui
Definition masterpropertieswidget.h:94
void plcUpdateDisplaySettings()
MasterPropertiesWidget::plcUpdateDisplaySettings Update the IO data from the table (display settings ...
Definition masterpropertieswidget.cpp:970
void setCellFromValue(int row, int col, const QString &val)
MasterPropertiesWidget::setCellFromValue Set a single table cell value, respecting the column widget ...
Definition masterpropertieswidget.cpp:786
QETProject * m_project
Definition masterpropertieswidget.h:99
void customContextMenu(const QPoint &pos, int i=0)
MasterPropertiesWidget::customContextMenu Display a context menu.
Definition masterpropertieswidget.cpp:439
void showElementFromTWI(QTreeWidgetItem *qtwi, int column)
MasterPropertiesWidget::showElementFromTWI Show the element corresponding to the given QTreeWidgetIte...
Definition masterpropertieswidget.cpp:393
void plcAddRow()
MasterPropertiesWidget::plcAddRow Add a new empty row to the PLC IO table.
Definition masterpropertieswidget.cpp:829
QMap< Element *, int > m_pending_group_indices
Definition masterpropertieswidget.h:96
void plcMoveRowDown()
MasterPropertiesWidget::plcMoveRowDown Move selected row down.
Definition masterpropertieswidget.cpp:922
void apply() override
MasterPropertiesWidget::apply If link between edited element and other change, apply the change with ...
Definition masterpropertieswidget.cpp:187
void plcShowTableContextMenu(const QPoint &pos)
MasterPropertiesWidget::plcShowTableContextMenu Show context menu for the PLC IO table.
Definition masterpropertieswidget.cpp:1034
QHash< QTreeWidgetItem *, Element * > m_qtwi_hash
Definition masterpropertieswidget.h:95
void plcMoveRowUp()
MasterPropertiesWidget::plcMoveRowUp Move selected row up.
Definition masterpropertieswidget.cpp:889
QSpinBox * m_plc_row_height_spinbox
Definition masterpropertieswidget.h:112
Definition qetproject.h:77
Definition autonumberingdockwidget.h:30