QElectroTech  0.8-dev
linksingleelementwidget.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 LINKSINGLEELEMENTWIDGET_H
19 #define LINKSINGLEELEMENTWIDGET_H
20 
21 #include "element.h"
23 
24 class QTreeWidgetItem;
25 
26 namespace Ui {
28 }
29 
42 {
43  Q_OBJECT
44 
46  public:
47  explicit LinkSingleElementWidget(Element *elmt,
48  QWidget *parent = nullptr);
49  ~LinkSingleElementWidget() override;
50 
51  void setElement (Element *element) override;
52  void apply() override;
53  QUndoCommand *associatedUndo() const override;
54  QString title() const override;
55 
56  public slots:
57  void updateUi() override;
58  void buildTree();
59 
60  public:
61  bool setLiveEdit(bool live_edit) override;
62 
63  private :
64  QList <Element *> availableElements();
65  void setUpCompleter();
66  void clearTreeWidget();
67  void setUpHeaderLabels();
68 
69  private slots:
72  void linkTriggered();
73  void hideButtons();
74  void showButtons();
75  void headerCustomContextMenuRequested(const QPoint &pos);
76 
78  void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column);
79  void on_m_tree_widget_customContextMenuRequested(const QPoint &pos);
82 
83  void on_m_search_field_textEdited(const QString &arg1);
84 
85  private:
86  Ui::LinkSingleElementWidget *ui;
87 
88  bool m_unlink = false;
90 
91  QHash <QTreeWidgetItem*, Element*> m_qtwi_elmt_hash;
92  QHash <QTreeWidgetItem*, QStringList> m_qtwi_strl_hash;
93 
94  QTreeWidgetItem *m_qtwi_at_context_menu = nullptr,
95  *m_pending_qtwi = nullptr;
96 
98  *m_element_to_link = nullptr;
99 
101  QAction *m_link_action,
105 };
106 
107 #endif // LINKSINGLEELEMENTWIDGET_H
autonum::sequentialNumbers
Definition: assignvariables.h:35
PropertiesEditorWidget::m_live_edit
bool m_live_edit
Definition: propertieseditorwidget.h:50
ElementProvider
Definition: elementprovider.h:37
QetGraphicsItem::diagram
Diagram * diagram() const
Definition: qetgraphicsitem.cpp:40
conductor.h
Element::NextReport
@ NextReport
Definition: element.h:52
linksingleelementwidget.h
diagramposition.h
ElementProvider::find
QList< Element * > find(const int filter) const
ElementProvider::find Search and return the asked element corresponding with the given filter.
Definition: elementprovider.cpp:96
Element::setHighlighted
virtual void setHighlighted(bool)
Definition: element.cpp:178
QETProject::diagramRemoved
void diagramRemoved(QETProject *, Diagram *)
Diagram::showMe
void showMe()
Definition: diagram.h:161
Element::linkedElementChanged
void linkedElementChanged()
abstractelementpropertieseditorwidget.h
Element::Simple
@ Simple
Definition: element.h:51
Element::Slave
@ Slave
Definition: element.h:56
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
elementprovider.h
AbstractElementPropertiesEditorWidget
The AbstractElementPropertiesEditorWidget class This class provide common method for all widget used ...
Definition: abstractelementpropertieseditorwidget.h:31
Element::kind
kind
The kind enum Used to know the kind of this element (master, slave, report ect...)
Definition: element.h:51
Element::Master
@ Master
Definition: element.h:55
element.h
ElementProvider::freeElement
QList< Element * > freeElement(const int filter) const
ElementProvider::FreeElement Search and return the asked element corresponding with the given filter ...
Definition: elementprovider.cpp:54
Element
Definition: element.h:41
ConductorProperties::m_function
QString m_function
Definition: conductorproperties.h:90
autonum::AssignVariables::formulaToLabel
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the formula with variable assigned (ready to be displayed)
Definition: assignvariables.cpp:187
linkelementcommand.h
Element::AllReport
@ AllReport
Definition: element.h:54
Ui
Definition: autonumberingdockwidget.h:25
ConductorProperties
The ConductorProperties class This class represents the functional properties of a particular conduct...
Definition: conductorproperties.h:68
ConductorProperties::m_wire_color
QString m_wire_color
Definition: conductorproperties.h:92
ConductorProperties::text
QString text
Definition: conductorproperties.h:89
ConductorProperties::m_tension_protocol
QString m_tension_protocol
Definition: conductorproperties.h:91
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
Element::PreviousReport
@ PreviousReport
Definition: element.h:53
ConductorProperties::m_wire_section
QString m_wire_section
Definition: conductorproperties.h:93
diagram.h
AbstractElementPropertiesEditorWidget::m_element
QPointer< Element > m_element
Definition: abstractelementpropertieseditorwidget.h:38