QElectroTech  0.70
elementspanel.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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 PANELAPPAREILS_H
19 #define PANELAPPAREILS_H
20 
21 #include "genericpanel.h"
22 #include "templatelocation.h"
23 
24 class QETProject;
25 class Diagram;
27 
34 class ElementsPanel : public GenericPanel {
35  Q_OBJECT
36 
37  // constructors, destructor
38  public:
39  ElementsPanel(QWidget * = nullptr);
40  ~ElementsPanel() override;
41 
42  private:
44 
45  // methods
46  public:
47  // methods used to determine what is represented by a particular visual item
48 
49  // methods used to get what is represented by a particular visual item
50  QString dirPathForItem(QTreeWidgetItem *);
51  QString filePathForItem(QTreeWidgetItem *);
52 
53  signals:
55  void requestForDiagram(Diagram *);
57 
58  public slots:
59  void slot_doubleClick(QTreeWidgetItem *, int);
60  void reload(bool = false);
61  void filter(const QString &, QET::Filtering = QET::RegularFilter);
64  void buildFilterList();
65  void applyCurrentFilter(const QList<QTreeWidgetItem *> &);
66  void ensureHierarchyIsVisible(const QList<QTreeWidgetItem *> &);
67 
68  protected:
69  void startDrag(Qt::DropActions) override;
71  bool matchesFilter(const QTreeWidgetItem *, const QString&) const;
72 
73  protected slots:
74  void panelContentChange();
75 
76  private:
77  QTreeWidgetItem *addProject (QETProject *, QTreeWidgetItem * = nullptr, PanelOptions = AddAllChild) override;
78  QTreeWidgetItem *updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions = AddAllChild, bool = false) override;
79  QTreeWidgetItem *updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool = false) override;
80 
81  // attributes
82  private:
83  QSet<QETProject *> projects_to_display_;
84  QTreeWidgetItem *common_tbt_collection_item_;
85  QTreeWidgetItem *custom_tbt_collection_item_;
87  QString filter_;
88  QStringList filter_list_;
89 };
90 #endif
QStringList filter_list_
Currently applied list of filter.
Definition: elementspanel.h:88
ElementsPanel(QWidget *=nullptr)
void requestForDiagram(Diagram *)
QTreeWidgetItem * addProject(QETProject *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild) override
void slot_doubleClick(QTreeWidgetItem *, int)
QString dirPathForItem(QTreeWidgetItem *)
void startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &)
void projectWasOpened(QETProject *)
bool first_reload_
used to distinguish the first time this panel is reloaded
Definition: elementspanel.h:86
QTreeWidgetItem * custom_tbt_collection_item_
pointer to the item representing the user templates collection
Definition: elementspanel.h:85
void filter(const QString &, QET::Filtering=QET::RegularFilter)
void requestForTitleBlockTemplate(const TitleBlockTemplateLocation &)
~ElementsPanel() override
void projectWasClosed(QETProject *)
void ensureHierarchyIsVisible(const QList< QTreeWidgetItem *> &)
void requestForProject(QETProject *)
bool matchesFilter(const QTreeWidgetItem *, const QString &) const
QString filePathForItem(QTreeWidgetItem *)
QTreeWidgetItem * updateTemplateItem(QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool=false) override
void startDrag(Qt::DropActions) override
void reload(bool=false)
ElementsPanel::reload Reload the elements tree.
void applyCurrentFilter(const QList< QTreeWidgetItem *> &)
void buildFilterList()
QSet< QETProject * > projects_to_display_
list of projects that have been added to this panel
Definition: elementspanel.h:83
QString filter_
Currently applied filter.
Definition: elementspanel.h:87
void panelContentChange()
Filtering
Definition: qet.h:114
QTreeWidgetItem * common_tbt_collection_item_
pointer to the item representing the common templates collection
Definition: elementspanel.h:84
QTreeWidgetItem * updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) override