QElectroTech
0.70
|
The ElementsCollectionWidget class This widget embedd a tree view that display the element collection (common, custom, embedded) and all action needed to use this widget. This is the element collection widget used in the diagram editor. More...
#include <elementscollectionwidget.h>
Public Slots | |
void | reload () |
ElementsCollectionWidget::reload, the displayed collections. More... | |
Public Member Functions | |
ElementsCollectionWidget (QWidget *parent=nullptr) | |
ElementsCollectionWidget::ElementsCollectionWidget Default constructor. More... | |
void | expandFirstItems () |
ElementsCollectionWidget::expandFirstItems Expand each first item in the tree view. More... | |
void | addProject (QETProject *project) |
ElementsCollectionWidget::addProject Add to be displayed. More... | |
void | removeProject (QETProject *project) |
void | highlightUnusedElement () |
ElementsCollectionWidget::highlightUnusedElement highlight the unused element ElementsCollectionModel::highlightUnusedElement() More... | |
void | setCurrentLocation (const ElementsLocation &location) |
ElementsCollectionWidget::setCurrentLocation Set the current item to be the item for . More... | |
Protected Member Functions | |
void | leaveEvent (QEvent *event) override |
Private Member Functions | |
void | setUpAction () |
void | setUpWidget () |
ElementsCollectionWidget::setUpWidget Setup this widget. More... | |
void | setUpConnection () |
ElementsCollectionWidget::setUpConnection Setup the connection used in this widget. More... | |
void | customContextMenu (const QPoint &point) |
ElementsCollectionWidget::customContextMenu Display the context menu of this widget at . More... | |
void | openDir () |
ElementsCollectionWidget::openDir Open the directory represented by the current selected item. More... | |
void | editElement () |
ElementsCollectionWidget::editElement Edit the element represented by the current selected item. More... | |
void | deleteElement () |
ElementsCollectionWidget::deleteElement Delete the element represented by the current selected item. More... | |
void | deleteDirectory () |
ElementsCollectionWidget::deleteDirectory Delete directory represented by the current selected item. More... | |
void | editDirectory () |
ElementsCollectionWidget::editDirectory Edit the directory represented by the current selected item. More... | |
void | newDirectory () |
ElementsCollectionWidget::newDirectory Create a new directory. More... | |
void | newElement () |
ElementsCollectionWidget::newElement Create a new element. More... | |
void | showThisDir () |
ElementsCollectionWidget::showThisDir Hide all directories except the pointed dir;. More... | |
void | resetShowThisDir () |
ElementsCollectionWidget::resetShowThisDir reset show this dir, all collection are show. If search field isn't empty, apply the search after show all collection. More... | |
void | dirProperties () |
ElementsCollectionWidget::dirProperties Open an informative dialog about the curent index. More... | |
void | search () |
ElementsCollectionWidget::search Search every item (directory or element) that match the text of m_search_field and display it, other item who does not match is hidden. More... | |
void | hideCollection (bool hide=true) |
ElementsCollectionWidget::hideCollection Hide all collection displayed in this tree. More... | |
void | hideItem (bool hide, const QModelIndex &index=QModelIndex(), bool recursive=true) |
ElementsCollectionWidget::hideItem Hide the item . If is true, hide all subchilds of . More... | |
void | showAndExpandItem (const QModelIndex &index, bool parent=true, bool child=false) |
ElementsCollectionWidget::showAndExpandItem Show the item and expand it. If parent is true, ensure parents of is show and expanded If child is true, ensure all childs of is show and expended. More... | |
ElementCollectionItem * | elementCollectionItemForIndex (const QModelIndex &index) |
ElementsCollectionWidget::elementCollectionItemForIndex. More... | |
void | locationWasSaved (const ElementsLocation &location) |
ElementsCollectionWidget::locationWasSaved This method is connected with the signal savedToLocation of Element editor (see ElementsCollectionWidget::editElement()) Update or add the item represented by location to m_model. More... | |
Private Attributes | |
ElementsCollectionModel * | m_model |
QLineEdit * | m_search_field |
QTimer | m_search_timer |
ElementsTreeView * | m_tree_view |
QVBoxLayout * | m_main_vlayout |
QMenu * | m_context_menu |
QModelIndex | m_index_at_context_menu |
QModelIndex | m_showed_index |
QProgressBar * | m_progress_bar |
QAction * | m_open_dir |
QAction * | m_edit_element |
QAction * | m_delete_element |
QAction * | m_delete_dir |
QAction * | m_reload |
QAction * | m_edit_dir |
QAction * | m_new_directory |
QAction * | m_new_element |
QAction * | m_show_this_dir |
QAction * | m_show_all_dir |
QAction * | m_dir_propertie |
bool | m_first_show = true |
QList< QETProject * > | m_waiting_project |
The ElementsCollectionWidget class This widget embedd a tree view that display the element collection (common, custom, embedded) and all action needed to use this widget. This is the element collection widget used in the diagram editor.
Definition at line 42 of file elementscollectionwidget.h.
ElementsCollectionWidget::ElementsCollectionWidget | ( | QWidget * | parent = nullptr | ) |
ElementsCollectionWidget::ElementsCollectionWidget Default constructor.
parent | : parent widget of this widget. |
Definition at line 45 of file elementscollectionwidget.cpp.
References m_search_timer, setUpAction(), setUpConnection(), and setUpWidget().
void ElementsCollectionWidget::addProject | ( | QETProject * | project | ) |
ElementsCollectionWidget::addProject Add to be displayed.
project |
Definition at line 86 of file elementscollectionwidget.cpp.
References ElementsCollectionModel::highlightUnusedElement(), ElementsCollectionModel::loadCollections(), ElementsCollectionModel::loadingMaxValue(), ElementsCollectionModel::loadingProgressValue(), m_model, m_progress_bar, and m_waiting_project.
Referenced by QETDiagramEditor::addProject().
|
private |
ElementsCollectionWidget::customContextMenu Display the context menu of this widget at .
point |
Definition at line 229 of file elementscollectionwidget.cpp.
References elementCollectionItemForIndex(), XmlProjectElementCollectionItem::isCollectionRoot(), FileElementCollectionItem::isCollectionRoot(), FileElementCollectionItem::isCommonCollection(), ElementCollectionItem::isDir(), FileElementCollectionItem::isDir(), ElementCollectionItem::isElement(), m_context_menu, m_delete_dir, m_delete_element, m_dir_propertie, m_edit_dir, m_edit_element, m_index_at_context_menu, m_new_directory, m_new_element, m_open_dir, m_reload, m_show_all_dir, m_show_this_dir, m_showed_index, m_tree_view, FileElementCollectionItem::Type, XmlProjectElementCollectionItem::Type, and ElementCollectionItem::type().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::deleteDirectory Delete directory represented by the current selected item.
Definition at line 367 of file elementscollectionwidget.cpp.
References ElementCollectionItem::collectionPath(), elementCollectionItemForIndex(), m_index_at_context_menu, m_model, QET::QetMessageBox::question(), QET::Icons::tr, and QET::QetMessageBox::warning().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::deleteElement Delete the element represented by the current selected item.
Definition at line 335 of file elementscollectionwidget.cpp.
References ElementCollectionItem::collectionPath(), elementCollectionItemForIndex(), m_index_at_context_menu, m_model, QET::QetMessageBox::question(), QET::Icons::tr, and QET::QetMessageBox::warning().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::dirProperties Open an informative dialog about the curent index.
Definition at line 512 of file elementscollectionwidget.cpp.
References ElementCollectionItem::collectionPath(), ElementCollectionItem::directoriesChild(), elementCollectionItemForIndex(), ElementCollectionItem::elementsChild(), QET::QetMessageBox::information(), ElementCollectionItem::isDir(), ElementCollectionItem::localName(), m_index_at_context_menu, QET::Icons::tr, FileElementCollectionItem::Type, and ElementCollectionItem::type().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::editDirectory Edit the directory represented by the current selected item.
Definition at line 401 of file elementscollectionwidget.cpp.
References ElementCollectionItem::clearData(), FileElementCollectionItem::collectionPath(), elementCollectionItemForIndex(), FileElementCollectionItem::isCommonCollection(), m_index_at_context_menu, FileElementCollectionItem::Type, and ElementCollectionItem::type().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::editElement Edit the element represented by the current selected item.
Definition at line 316 of file elementscollectionwidget.cpp.
References ElementCollectionItem::collectionPath(), elementCollectionItemForIndex(), QETApp::instance(), ElementCollectionItem::isElement(), locationWasSaved(), m_index_at_context_menu, and QETElementEditor::saveToLocation().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::elementCollectionItemForIndex.
index |
Definition at line 686 of file elementscollectionwidget.cpp.
References m_model.
Referenced by customContextMenu(), deleteDirectory(), deleteElement(), dirProperties(), editDirectory(), editElement(), newDirectory(), newElement(), openDir(), resetShowThisDir(), setUpConnection(), and showThisDir().
void ElementsCollectionWidget::expandFirstItems | ( | ) |
ElementsCollectionWidget::expandFirstItems Expand each first item in the tree view.
Definition at line 72 of file elementscollectionwidget.cpp.
References m_model, and showAndExpandItem().
Referenced by reload(), search(), and QETDiagramEditor::setUpElementsCollectionWidget().
|
private |
ElementsCollectionWidget::hideCollection Hide all collection displayed in this tree.
hide- | true = hide , false = visible |
Definition at line 639 of file elementscollectionwidget.cpp.
References hideItem(), and m_model.
Referenced by search(), and showThisDir().
|
private |
ElementsCollectionWidget::hideItem Hide the item . If is true, hide all subchilds of .
hide- | true = hide , false = visible |
index- | index to hide |
recursive- | true = apply to child , false = only for |
Definition at line 652 of file elementscollectionwidget.cpp.
References m_model, and m_tree_view.
Referenced by hideCollection(), and showAndExpandItem().
void ElementsCollectionWidget::highlightUnusedElement | ( | ) |
ElementsCollectionWidget::highlightUnusedElement highlight the unused element ElementsCollectionModel::highlightUnusedElement()
Definition at line 112 of file elementscollectionwidget.cpp.
References ElementsCollectionModel::highlightUnusedElement(), and m_model.
Referenced by QETDiagramEditor::save(), and QETDiagramEditor::saveAs().
|
overrideprotected |
Definition at line 131 of file elementscollectionwidget.cpp.
References QETApp::diagramEditorAncestorOf().
|
private |
ElementsCollectionWidget::locationWasSaved This method is connected with the signal savedToLocation of Element editor (see ElementsCollectionWidget::editElement()) Update or add the item represented by location to m_model.
location |
Definition at line 569 of file elementscollectionwidget.cpp.
References ElementsCollectionModel::addLocation(), ElementsLocation::exist(), ElementsCollectionModel::indexFromLocation(), m_model, and setUpData().
Referenced by editElement(), and newElement().
|
private |
ElementsCollectionWidget::newDirectory Create a new directory.
Definition at line 421 of file elementscollectionwidget.cpp.
References ElementsCollectionModel::addLocation(), FileElementCollectionItem::collectionPath(), elementCollectionItemForIndex(), FileElementCollectionItem::isCommonCollection(), m_index_at_context_menu, m_model, FileElementCollectionItem::Type, and ElementCollectionItem::type().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::newElement Create a new element.
Definition at line 440 of file elementscollectionwidget.cpp.
References FileElementCollectionItem::collectionPath(), elementCollectionItemForIndex(), QETApp::instance(), FileElementCollectionItem::isCommonCollection(), locationWasSaved(), m_index_at_context_menu, NewElementWizard::preselectedLocation(), QETElementEditor::saveToLocation(), FileElementCollectionItem::Type, and ElementCollectionItem::type().
Referenced by setUpConnection().
|
private |
ElementsCollectionWidget::openDir Open the directory represented by the current selected item.
Definition at line 290 of file elementscollectionwidget.cpp.
References elementCollectionItemForIndex(), m_index_at_context_menu, FileElementCollectionItem::Type, ElementCollectionItem::type(), and XmlProjectElementCollectionItem::Type.
Referenced by setUpConnection().
|
slot |
ElementsCollectionWidget::reload, the displayed collections.
Definition at line 533 of file elementscollectionwidget.cpp.
References expandFirstItems(), ElementsCollectionModel::highlightUnusedElement(), ElementsCollectionModel::loadCollections(), ElementsCollectionModel::loadingMaxValue(), ElementsCollectionModel::loadingProgressValue(), m_index_at_context_menu, m_model, m_progress_bar, m_showed_index, m_tree_view, m_waiting_project, and ElementsCollectionModel::project().
Referenced by setUpConnection().
void ElementsCollectionWidget::removeProject | ( | QETProject * | project | ) |
Definition at line 102 of file elementscollectionwidget.cpp.
References m_model, and ElementsCollectionModel::removeProject().
Referenced by QETDiagramEditor::projectWasClosed().
|
private |
ElementsCollectionWidget::resetShowThisDir reset show this dir, all collection are show. If search field isn't empty, apply the search after show all collection.
Definition at line 495 of file elementscollectionwidget.cpp.
References elementCollectionItemForIndex(), m_showed_index, and search().
Referenced by setUpConnection(), and showThisDir().
|
private |
ElementsCollectionWidget::search Search every item (directory or element) that match the text of m_search_field and display it, other item who does not match is hidden.
Definition at line 595 of file elementscollectionwidget.cpp.
References expandFirstItems(), hideCollection(), m_model, m_search_field, m_showed_index, m_tree_view, and showAndExpandItem().
Referenced by resetShowThisDir(), setUpConnection(), and showThisDir().
void ElementsCollectionWidget::setCurrentLocation | ( | const ElementsLocation & | location | ) |
ElementsCollectionWidget::setCurrentLocation Set the current item to be the item for .
location |
Definition at line 123 of file elementscollectionwidget.cpp.
References ElementsLocation::exist(), ElementsCollectionModel::indexFromLocation(), m_model, and m_tree_view.
Referenced by QETDiagramEditor::findElementInPanel().
|
private |
Definition at line 139 of file elementscollectionwidget.cpp.
References QET::Icons::ElementDelete, QET::Icons::ElementEdit, QET::Icons::ElementNew, QET::Icons::FolderDelete, QET::Icons::FolderEdit, QET::Icons::FolderNew, QET::Icons::FolderOnlyThis, QET::Icons::FolderOpen, QET::Icons::FolderProperties, QET::Icons::FolderShowAll, m_delete_dir, m_delete_element, m_dir_propertie, m_edit_dir, m_edit_element, m_new_directory, m_new_element, m_open_dir, m_reload, m_show_all_dir, m_show_this_dir, QET::Icons::tr, and QET::Icons::ViewRefresh.
Referenced by ElementsCollectionWidget().
|
private |
ElementsCollectionWidget::setUpConnection Setup the connection used in this widget.
Definition at line 195 of file elementscollectionwidget.cpp.
References customContextMenu(), deleteDirectory(), deleteElement(), QETApp::diagramEditorAncestorOf(), dirProperties(), editDirectory(), editElement(), elementCollectionItemForIndex(), ElementCollectionItem::localName(), m_delete_dir, m_delete_element, m_dir_propertie, m_edit_dir, m_edit_element, m_index_at_context_menu, m_new_directory, m_new_element, m_open_dir, m_reload, m_search_field, m_search_timer, m_show_all_dir, m_show_this_dir, m_tree_view, newDirectory(), newElement(), openDir(), reload(), resetShowThisDir(), search(), and showThisDir().
Referenced by ElementsCollectionWidget().
|
private |
ElementsCollectionWidget::setUpWidget Setup this widget.
Definition at line 158 of file elementscollectionwidget.cpp.
References m_context_menu, m_main_vlayout, m_progress_bar, m_search_field, m_tree_view, and QET::Icons::tr.
Referenced by ElementsCollectionWidget().
|
private |
ElementsCollectionWidget::showAndExpandItem Show the item and expand it. If parent is true, ensure parents of is show and expanded If child is true, ensure all childs of is show and expended.
index- | index to show |
parent- | Apply to parent |
child- | Apply to all childs |
Definition at line 670 of file elementscollectionwidget.cpp.
References hideItem(), and m_tree_view.
Referenced by expandFirstItems(), search(), and showThisDir().
|
private |
ElementsCollectionWidget::showThisDir Hide all directories except the pointed dir;.
Definition at line 466 of file elementscollectionwidget.cpp.
References elementCollectionItemForIndex(), hideCollection(), m_index_at_context_menu, m_showed_index, resetShowThisDir(), search(), and showAndExpandItem().
Referenced by setUpConnection().
|
private |
Definition at line 93 of file elementscollectionwidget.h.
Referenced by customContextMenu(), and setUpWidget().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 110 of file elementscollectionwidget.h.
|
private |
Definition at line 94 of file elementscollectionwidget.h.
Referenced by customContextMenu(), deleteDirectory(), deleteElement(), dirProperties(), editDirectory(), editElement(), newDirectory(), newElement(), openDir(), reload(), setUpConnection(), and showThisDir().
|
private |
Definition at line 92 of file elementscollectionwidget.h.
Referenced by setUpWidget().
|
private |
Definition at line 88 of file elementscollectionwidget.h.
Referenced by addProject(), deleteDirectory(), deleteElement(), elementCollectionItemForIndex(), expandFirstItems(), hideCollection(), hideItem(), highlightUnusedElement(), locationWasSaved(), newDirectory(), reload(), removeProject(), search(), and setCurrentLocation().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 96 of file elementscollectionwidget.h.
Referenced by addProject(), reload(), and setUpWidget().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 89 of file elementscollectionwidget.h.
Referenced by search(), setUpConnection(), and setUpWidget().
|
private |
Definition at line 90 of file elementscollectionwidget.h.
Referenced by ElementsCollectionWidget(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 98 of file elementscollectionwidget.h.
Referenced by customContextMenu(), setUpAction(), and setUpConnection().
|
private |
Definition at line 95 of file elementscollectionwidget.h.
Referenced by customContextMenu(), reload(), resetShowThisDir(), search(), and showThisDir().
|
private |
Definition at line 91 of file elementscollectionwidget.h.
Referenced by customContextMenu(), hideItem(), reload(), search(), setCurrentLocation(), setUpConnection(), setUpWidget(), and showAndExpandItem().
|
private |
Definition at line 111 of file elementscollectionwidget.h.
Referenced by addProject(), and reload().