QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
plclinkwidget.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 PLCLINKWIDGET_H
19#define PLCLINKWIDGET_H
20
22
23#include <QHash>
24#include <QPointer>
25#include <QSet>
26
27class QTreeWidgetItem;
28class QTreeWidget;
29class QLineEdit;
30class QPushButton;
31class QLabel;
32class Element;
33
42{
43 Q_OBJECT
44
45 public:
46 explicit PlcLinkWidget(Element *elmt, QWidget *parent = nullptr);
47 ~PlcLinkWidget() override = default;
48
49 void setElement(Element *element) override;
50 void apply() override;
51 QUndoCommand *associatedUndo() const override;
52 QString title() const override;
53
54 public slots:
55 void updateUi() override;
56
57 private:
58 void buildPlcTree();
59 void hideButtons();
60 void showButtons();
61
62 private slots:
63 void on_m_search_field_textEdited(const QString &text);
64 void on_m_tree_widget_customContextMenuRequested(const QPoint &pos);
67
68 private:
69 QLabel *m_label{nullptr};
70 QPushButton *m_unlink_pb{nullptr};
71 QPushButton *m_show_this_pb{nullptr};
72 QLineEdit *m_search_field{nullptr};
73 QTreeWidget *m_tree_widget{nullptr};
74 QLabel *m_hidden_masters_label{nullptr};
75
76 // Maps IO child items to (master, io_index)
77 struct PlcIoEntry {
78 QPointer<Element> master;
79 int ioIndex = -1;
80 };
81 QHash<QTreeWidgetItem*, PlcIoEntry> m_io_entry_hash;
82
85};
86
87#endif // PLCLINKWIDGET_H
AbstractElementPropertiesEditorWidget(QWidget *parent=nullptr)
Definition abstractelementpropertieseditorwidget.cpp:20
Definition element.h:44
Definition plclinkwidget.h:77
QPointer< Element > master
Definition plclinkwidget.h:78
int ioIndex
Definition plclinkwidget.h:79