QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
elementscollectionwidget.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 ELEMENTSCOLLECTIONWIDGET_H
19#define ELEMENTSCOLLECTIONWIDGET_H
20
21#include "elementslocation.h"
22
23#include <QWidget>
24#include <QModelIndex>
25#include <QTimer>
26#include <QElapsedTimer>
27#include <QScopedPointer>
28#include <QTabWidget>
29#include <QTreeView>
30
32class QVBoxLayout;
33class QMenu;
34class QLineEdit;
36class QProgressBar;
37class QETProject;
39
46class ElementsCollectionWidget : public QWidget
47{
48 Q_OBJECT
49
50 public:
51 ElementsCollectionWidget(QWidget *parent = nullptr);
52
53 void expandFirstItems();
54
55 void addProject (QETProject *project);
56 void removeProject (QETProject *project);
58 void setCurrentLocation(const ElementsLocation &location);
59
60 protected:
61 void leaveEvent(QEvent *event) override;
62
63 private:
64 void setUpAction();
65 void setUpWidget();
66 void setUpConnection();
67 void customContextMenu(const QPoint &point);
68 void openDir();
69 void editElement();
70 void deleteElement();
71 void deleteDirectory();
72 void editDirectory();
73 void newDirectory();
74 void newElement();
76 void importEdz();
77 void showThisDir();
78 void resetShowThisDir();
79 void dirProperties();
80 void search();
81 void hideCollection(bool hide = true);
82 void hideItem(bool hide, const QModelIndex &index = QModelIndex(), bool recursive = true);
83 void showAndExpandItem (const QModelIndex &index, bool parent = true, bool child = false);
84 ElementCollectionItem *elementCollectionItemForIndex (const QModelIndex &index);
85
86 public slots:
87 void reload();
88 void loadingFinished();
89
90 private:
91 void locationWasSaved(const ElementsLocation& location);
92
93
94 private:
98 QLineEdit *m_search_field;
102 QTabWidget *m_tab_widget = nullptr;
103 QVBoxLayout *m_main_vlayout;
106 QModelIndex m_showed_index;
107 QProgressBar *m_progress_bar;
108
109 QAction *m_open_dir,
121
122 bool m_first_show = true;
123 QList<QETProject *> m_waiting_project;
124 QScopedPointer<QElapsedTimer> m_loading_timer;
125};
126
127#endif // ELEMENTSCOLLECTIONWIDGET_H
The ElementCollectionItem class This class represent a item (a directory or an element) in a element ...
Definition elementcollectionitem.h:30
Definition elementscollectionmodel.h:33
void deleteElement()
ElementsCollectionWidget::deleteElement Delete the element represented by the current selected item.
Definition elementscollectionwidget.cpp:437
QMenu * m_context_menu
Definition elementscollectionwidget.h:104
QModelIndex m_index_at_context_menu
Definition elementscollectionwidget.h:105
ElementsCollectionWidget(QWidget *parent=nullptr)
ElementsCollectionWidget::ElementsCollectionWidget Default constructor.
Definition elementscollectionwidget.cpp:57
void newElement()
ElementsCollectionWidget::newElement Create a new element.
Definition elementscollectionwidget.cpp:586
ElementsCollectionModel * m_new_model
Definition elementscollectionwidget.h:96
void addProject(QETProject *project)
ElementsCollectionWidget::addProject Add project to be displayed.
Definition elementscollectionwidget.cpp:99
QAction * m_reload
Definition elementscollectionwidget.h:113
QAction * m_open_dir
Definition elementscollectionwidget.h:109
void importEdz()
ElementsCollectionWidget::importEdz Import an EPLAN Data Portal part (.edz) as a QET element into the...
Definition elementscollectionwidget.cpp:679
QAction * m_delete_dir
Definition elementscollectionwidget.h:112
void loadingFinished()
ElementsCollectionWidget::loadingFinished Process when collection finished to be loaded.
Definition elementscollectionwidget.cpp:855
void editElement()
ElementsCollectionWidget::editElement Edit the element represented by the current selected item.
Definition elementscollectionwidget.cpp:412
ElementsCollectionModel * m_macros_model
Definition elementscollectionwidget.h:97
QProgressBar * m_progress_bar
Definition elementscollectionwidget.h:107
ElementsTreeView * m_macros_tree_view
Definition elementscollectionwidget.h:101
void setUpAction()
Definition elementscollectionwidget.cpp:150
QAction * m_show_all_dir
Definition elementscollectionwidget.h:119
void expandFirstItems()
ElementsCollectionWidget::expandFirstItems Expand each first item in the tree view.
Definition elementscollectionwidget.cpp:85
QScopedPointer< QElapsedTimer > m_loading_timer
Definition elementscollectionwidget.h:124
QTimer m_search_timer
Definition elementscollectionwidget.h:99
void hideItem(bool hide, const QModelIndex &index=QModelIndex(), bool recursive=true)
ElementsCollectionWidget::hideItem Hide the item index. If recursive is true, hide all subchilds of i...
Definition elementscollectionwidget.cpp:988
QAction * m_new_element
Definition elementscollectionwidget.h:116
void showAndExpandItem(const QModelIndex &index, bool parent=true, bool child=false)
ElementsCollectionWidget::showAndExpandItem Show the item index and expand it. If parent is true,...
Definition elementscollectionwidget.cpp:1008
ElementsTreeView * m_tree_view
Definition elementscollectionwidget.h:100
void setUpConnection()
ElementsCollectionWidget::setUpConnection Setup the connection used in this widget.
Definition elementscollectionwidget.cpp:235
void deleteDirectory()
ElementsCollectionWidget::deleteDirectory Delete directory represented by the current selected item.
Definition elementscollectionwidget.cpp:486
QTabWidget * m_tab_widget
Definition elementscollectionwidget.h:102
void resetShowThisDir()
ElementsCollectionWidget::resetShowThisDir reset show this dir, all collection are show....
Definition elementscollectionwidget.cpp:751
ElementCollectionItem * elementCollectionItemForIndex(const QModelIndex &index)
ElementsCollectionWidget::elementCollectionItemForIndex.
Definition elementscollectionwidget.cpp:1026
void dirProperties()
ElementsCollectionWidget::dirProperties Open an informative dialog about the current index.
Definition elementscollectionwidget.cpp:769
void openDir()
ElementsCollectionWidget::openDir Open the directory represented by the current selected item.
Definition elementscollectionwidget.cpp:385
void reload()
ElementsCollectionWidget::reload, the displayed collections.
Definition elementscollectionwidget.cpp:802
bool m_first_show
Definition elementscollectionwidget.h:122
bool confirmEdzImportTerms()
ElementsCollectionWidget::confirmEdzImportTerms Show the EPLAN (.edz) import warning dialog....
Definition elementscollectionwidget.cpp:620
QAction * m_import_edz
Definition elementscollectionwidget.h:117
void showThisDir()
ElementsCollectionWidget::showThisDir Hide all directories except the pointed dir;.
Definition elementscollectionwidget.cpp:720
void search()
ElementsCollectionWidget::search Search every item (directory or element) that match the text of m_se...
Definition elementscollectionwidget.cpp:919
QVBoxLayout * m_main_vlayout
Definition elementscollectionwidget.h:103
QAction * m_dir_propertie
Definition elementscollectionwidget.h:120
QLineEdit * m_search_field
Definition elementscollectionwidget.h:98
void hideCollection(bool hide=true)
ElementsCollectionWidget::hideCollection Hide all collection displayed in this tree.
Definition elementscollectionwidget.cpp:974
QAction * m_new_directory
Definition elementscollectionwidget.h:115
void setUpWidget()
ElementsCollectionWidget::setUpWidget Setup this widget.
Definition elementscollectionwidget.cpp:183
void newDirectory()
ElementsCollectionWidget::newDirectory Create a new directory.
Definition elementscollectionwidget.cpp:555
QAction * m_delete_element
Definition elementscollectionwidget.h:111
QAction * m_edit_element
Definition elementscollectionwidget.h:110
void setCurrentLocation(const ElementsLocation &location)
ElementsCollectionWidget::setCurrentLocation Set the current item to be the item for location.
Definition elementscollectionwidget.cpp:131
void leaveEvent(QEvent *event) override
Definition elementscollectionwidget.cpp:142
void editDirectory()
ElementsCollectionWidget::editDirectory Edit the directory represented by the current selected item.
Definition elementscollectionwidget.cpp:533
QAction * m_show_this_dir
Definition elementscollectionwidget.h:118
QAction * m_edit_dir
Definition elementscollectionwidget.h:114
void customContextMenu(const QPoint &point)
ElementsCollectionWidget::customContextMenu Display the context menu of this widget at point.
Definition elementscollectionwidget.cpp:315
void removeProject(QETProject *project)
Definition elementscollectionwidget.cpp:110
QModelIndex m_showed_index
Definition elementscollectionwidget.h:106
ElementsCollectionModel * m_model
Definition elementscollectionwidget.h:95
QList< QETProject * > m_waiting_project
Definition elementscollectionwidget.h:123
void highlightUnusedElement()
ElementsCollectionWidget::highlightUnusedElement highlight the unused element.
Definition elementscollectionwidget.cpp:120
void locationWasSaved(const ElementsLocation &location)
ElementsCollectionWidget::locationWasSaved This method is connected with the signal savedToLocation o...
Definition elementscollectionwidget.cpp:891
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition elementslocation.h:47
The ElementsTreeView class This class just reimplement startDrag from QTreeView, for set a custom pix...
Definition elementstreeview.h:32
Definition qetproject.h:77