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
21
#include "
abstractelementpropertieseditorwidget.h
"
22
23
#include <QHash>
24
#include <QPointer>
25
#include <QSet>
26
27
class
QTreeWidgetItem;
28
class
QTreeWidget;
29
class
QLineEdit;
30
class
QPushButton;
31
class
QLabel;
32
class
Element
;
33
41
class
PlcLinkWidget
:
public
AbstractElementPropertiesEditorWidget
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);
65
void
on_m_unlink_pb_clicked
();
66
void
on_m_show_this_pb_clicked
();
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
83
Element
*
m_element_to_link
=
nullptr
;
84
int
m_pending_io_index
= -1;
85
};
86
87
#endif
// PLCLINKWIDGET_H
abstractelementpropertieseditorwidget.h
AbstractElementPropertiesEditorWidget::AbstractElementPropertiesEditorWidget
AbstractElementPropertiesEditorWidget(QWidget *parent=nullptr)
Definition
abstractelementpropertieseditorwidget.cpp:20
Element
Definition
element.h:44
PlcLinkWidget::on_m_search_field_textEdited
void on_m_search_field_textEdited(const QString &text)
Definition
plclinkwidget.cpp:282
PlcLinkWidget::m_search_field
QLineEdit * m_search_field
Definition
plclinkwidget.h:72
PlcLinkWidget::on_m_unlink_pb_clicked
void on_m_unlink_pb_clicked()
Definition
plclinkwidget.cpp:352
PlcLinkWidget::updateUi
void updateUi() override
Definition
plclinkwidget.cpp:147
PlcLinkWidget::buildPlcTree
void buildPlcTree()
PlcLinkWidget::buildPlcTree Build the tree showing all PLC-Masters with their IO entries....
Definition
plclinkwidget.cpp:162
PlcLinkWidget::PlcLinkWidget
PlcLinkWidget(Element *elmt, QWidget *parent=nullptr)
Definition
plclinkwidget.cpp:45
PlcLinkWidget::showButtons
void showButtons()
Definition
plclinkwidget.cpp:274
PlcLinkWidget::on_m_show_this_pb_clicked
void on_m_show_this_pb_clicked()
Definition
plclinkwidget.cpp:364
PlcLinkWidget::m_element_to_link
Element * m_element_to_link
Definition
plclinkwidget.h:83
PlcLinkWidget::m_unlink_pb
QPushButton * m_unlink_pb
Definition
plclinkwidget.h:70
PlcLinkWidget::title
QString title() const override
PropertiesEditorWidget::title.
Definition
plclinkwidget.cpp:142
PlcLinkWidget::m_io_entry_hash
QHash< QTreeWidgetItem *, PlcIoEntry > m_io_entry_hash
Definition
plclinkwidget.h:81
PlcLinkWidget::m_label
QLabel * m_label
Definition
plclinkwidget.h:69
PlcLinkWidget::m_pending_io_index
int m_pending_io_index
Definition
plclinkwidget.h:84
PlcLinkWidget::associatedUndo
QUndoCommand * associatedUndo() const override
PropertiesEditorWidget::associatedUndo By default, return a nullptr.
Definition
plclinkwidget.cpp:131
PlcLinkWidget::m_tree_widget
QTreeWidget * m_tree_widget
Definition
plclinkwidget.h:73
PlcLinkWidget::apply
void apply() override
Definition
plclinkwidget.cpp:121
PlcLinkWidget::m_show_this_pb
QPushButton * m_show_this_pb
Definition
plclinkwidget.h:71
PlcLinkWidget::~PlcLinkWidget
~PlcLinkWidget() override=default
PlcLinkWidget::setElement
void setElement(Element *element) override
Definition
plclinkwidget.cpp:112
PlcLinkWidget::on_m_tree_widget_customContextMenuRequested
void on_m_tree_widget_customContextMenuRequested(const QPoint &pos)
Definition
plclinkwidget.cpp:314
PlcLinkWidget::hideButtons
void hideButtons()
Definition
plclinkwidget.cpp:266
PlcLinkWidget::m_hidden_masters_label
QLabel * m_hidden_masters_label
Definition
plclinkwidget.h:74
PlcLinkWidget::PlcIoEntry
Definition
plclinkwidget.h:77
PlcLinkWidget::PlcIoEntry::master
QPointer< Element > master
Definition
plclinkwidget.h:78
PlcLinkWidget::PlcIoEntry::ioIndex
int ioIndex
Definition
plclinkwidget.h:79
sources
ui
plclinkwidget.h
Generated by
1.15.0