QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
elementscollectionwidget.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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
30class QVBoxLayout;
31class QMenu;
32class QLineEdit;
34class QProgressBar;
35class QETProject;
37
44class ElementsCollectionWidget : public QWidget
45{
46 Q_OBJECT
47
48 public:
49 ElementsCollectionWidget(QWidget *parent = nullptr);
50
51 void expandFirstItems();
52
53 void addProject (QETProject *project);
54 void removeProject (QETProject *project);
56 void setCurrentLocation(const ElementsLocation &location);
57
58 protected:
59 void leaveEvent(QEvent *event) override;
60
61 private:
62 void setUpAction();
63 void setUpWidget();
64 void setUpConnection();
65 void customContextMenu(const QPoint &point);
66 void openDir();
67 void editElement();
68 void deleteElement();
69 void deleteDirectory();
70 void editDirectory();
71 void newDirectory();
72 void newElement();
73 void showThisDir();
74 void resetShowThisDir();
75 void dirProperties();
76 void search();
77 void hideCollection(bool hide = true);
78 void hideItem(bool hide, const QModelIndex &index = QModelIndex(), bool recursive = true);
79 void showAndExpandItem (const QModelIndex &index, bool parent = true, bool child = false);
80 ElementCollectionItem *elementCollectionItemForIndex (const QModelIndex &index);
81
82 public slots:
83 void reload();
84 void loadingFinished();
85
86 private:
87 void locationWasSaved(const ElementsLocation& location);
88
89
90 private:
93 QLineEdit *m_search_field;
96 QVBoxLayout *m_main_vlayout;
99 QModelIndex m_showed_index;
100 QProgressBar *m_progress_bar;
101
102 QAction *m_open_dir,
113
114 bool m_first_show = true;
115 QList<QETProject *> m_waiting_project;
116 QScopedPointer<QElapsedTimer> m_loading_timer;
117};
118
119#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
The ElementsCollectionWidget class This widget embedd a tree view that display the element collection...
Definition elementscollectionwidget.h:45
void deleteElement()
ElementsCollectionWidget::deleteElement Delete the element represented by the current selected item.
Definition elementscollectionwidget.cpp:379
QMenu * m_context_menu
Definition elementscollectionwidget.h:97
QModelIndex m_index_at_context_menu
Definition elementscollectionwidget.h:98
void newElement()
ElementsCollectionWidget::newElement Create a new element.
Definition elementscollectionwidget.cpp:511
ElementsCollectionModel * m_new_model
Definition elementscollectionwidget.h:92
void addProject(QETProject *project)
ElementsCollectionWidget::addProject Add project to be displayed.
Definition elementscollectionwidget.cpp:92
QAction * m_reload
Definition elementscollectionwidget.h:106
QAction * m_open_dir
Definition elementscollectionwidget.h:102
QAction * m_delete_dir
Definition elementscollectionwidget.h:105
void loadingFinished()
ElementsCollectionWidget::loadingFinished Process when collection finished to be loaded.
Definition elementscollectionwidget.cpp:676
void editElement()
ElementsCollectionWidget::editElement Edit the element represented by the current selected item.
Definition elementscollectionwidget.cpp:357
QProgressBar * m_progress_bar
Definition elementscollectionwidget.h:100
void setUpAction()
Definition elementscollectionwidget.cpp:146
QAction * m_show_all_dir
Definition elementscollectionwidget.h:111
void expandFirstItems()
ElementsCollectionWidget::expandFirstItems Expand each first item in the tree view.
Definition elementscollectionwidget.cpp:78
QScopedPointer< QElapsedTimer > m_loading_timer
Definition elementscollectionwidget.h:116
QTimer m_search_timer
Definition elementscollectionwidget.h:94
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:816
QAction * m_new_element
Definition elementscollectionwidget.h:109
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:836
ElementsTreeView * m_tree_view
Definition elementscollectionwidget.h:95
void setUpConnection()
ElementsCollectionWidget::setUpConnection Setup the connection used in this widget.
Definition elementscollectionwidget.cpp:214
void deleteDirectory()
ElementsCollectionWidget::deleteDirectory Delete directory represented by the current selected item.
Definition elementscollectionwidget.cpp:423
void resetShowThisDir()
ElementsCollectionWidget::resetShowThisDir reset show this dir, all collection are show....
Definition elementscollectionwidget.cpp:574
ElementCollectionItem * elementCollectionItemForIndex(const QModelIndex &index)
ElementsCollectionWidget::elementCollectionItemForIndex.
Definition elementscollectionwidget.cpp:854
void dirProperties()
ElementsCollectionWidget::dirProperties Open an informative dialog about the current index.
Definition elementscollectionwidget.cpp:592
void openDir()
ElementsCollectionWidget::openDir Open the directory represented by the current selected item.
Definition elementscollectionwidget.cpp:330
void reload()
ElementsCollectionWidget::reload, the displayed collections.
Definition elementscollectionwidget.cpp:630
bool m_first_show
Definition elementscollectionwidget.h:114
void showThisDir()
ElementsCollectionWidget::showThisDir Hide all directories except the pointed dir;.
Definition elementscollectionwidget.cpp:543
void search()
ElementsCollectionWidget::search Search every item (directory or element) that match the text of m_se...
Definition elementscollectionwidget.cpp:740
QVBoxLayout * m_main_vlayout
Definition elementscollectionwidget.h:96
QAction * m_dir_propertie
Definition elementscollectionwidget.h:112
QLineEdit * m_search_field
Definition elementscollectionwidget.h:93
void hideCollection(bool hide=true)
ElementsCollectionWidget::hideCollection Hide all collection displayed in this tree.
Definition elementscollectionwidget.cpp:802
QAction * m_new_directory
Definition elementscollectionwidget.h:108
void setUpWidget()
ElementsCollectionWidget::setUpWidget Setup this widget.
Definition elementscollectionwidget.cpp:177
void newDirectory()
ElementsCollectionWidget::newDirectory Create a new directory.
Definition elementscollectionwidget.cpp:490
QAction * m_delete_element
Definition elementscollectionwidget.h:104
QAction * m_edit_element
Definition elementscollectionwidget.h:103
void setCurrentLocation(const ElementsLocation &location)
ElementsCollectionWidget::setCurrentLocation Set the current item to be the item for location.
Definition elementscollectionwidget.cpp:127
void leaveEvent(QEvent *event) override
Definition elementscollectionwidget.cpp:138
void editDirectory()
ElementsCollectionWidget::editDirectory Edit the directory represented by the current selected item.
Definition elementscollectionwidget.cpp:468
QAction * m_show_this_dir
Definition elementscollectionwidget.h:110
QAction * m_edit_dir
Definition elementscollectionwidget.h:107
void customContextMenu(const QPoint &point)
ElementsCollectionWidget::customContextMenu Display the context menu of this widget at point.
Definition elementscollectionwidget.cpp:266
void removeProject(QETProject *project)
Definition elementscollectionwidget.cpp:106
QModelIndex m_showed_index
Definition elementscollectionwidget.h:99
ElementsCollectionModel * m_model
Definition elementscollectionwidget.h:91
QList< QETProject * > m_waiting_project
Definition elementscollectionwidget.h:115
void highlightUnusedElement()
ElementsCollectionWidget::highlightUnusedElement highlight the unused element.
Definition elementscollectionwidget.cpp:116
void locationWasSaved(const ElementsLocation &location)
ElementsCollectionWidget::locationWasSaved This method is connected with the signal savedToLocation o...
Definition elementscollectionwidget.cpp:712
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:62