QElectroTech  0.70
Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ElementsCollectionWidget Class Reference

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...
 
ElementCollectionItemelementCollectionItemForIndex (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

ElementsCollectionModelm_model
 
QLineEdit * m_search_field
 
QTimer m_search_timer
 
ElementsTreeViewm_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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ElementsCollectionWidget()

ElementsCollectionWidget::ElementsCollectionWidget ( QWidget *  parent = nullptr)

ElementsCollectionWidget::ElementsCollectionWidget Default constructor.

Parameters
parent: parent widget of this widget.

Definition at line 45 of file elementscollectionwidget.cpp.

References m_search_timer, setUpAction(), setUpConnection(), and setUpWidget().

Member Function Documentation

◆ addProject()

void ElementsCollectionWidget::addProject ( QETProject project)

◆ customContextMenu()

void ElementsCollectionWidget::customContextMenu ( const QPoint &  point)
private

◆ deleteDirectory()

void ElementsCollectionWidget::deleteDirectory ( )
private

◆ deleteElement()

void ElementsCollectionWidget::deleteElement ( )
private

◆ dirProperties()

void ElementsCollectionWidget::dirProperties ( )
private

◆ editDirectory()

void ElementsCollectionWidget::editDirectory ( )
private

◆ editElement()

void ElementsCollectionWidget::editElement ( )
private

◆ elementCollectionItemForIndex()

ElementCollectionItem * ElementsCollectionWidget::elementCollectionItemForIndex ( const QModelIndex &  index)
private

◆ expandFirstItems()

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().

◆ hideCollection()

void ElementsCollectionWidget::hideCollection ( bool  hide = true)
private

ElementsCollectionWidget::hideCollection Hide all collection displayed in this tree.

Parameters
hide-true = hide , false = visible

Definition at line 639 of file elementscollectionwidget.cpp.

References hideItem(), and m_model.

Referenced by search(), and showThisDir().

◆ hideItem()

void ElementsCollectionWidget::hideItem ( bool  hide,
const QModelIndex &  index = QModelIndex(),
bool  recursive = true 
)
private

ElementsCollectionWidget::hideItem Hide the item . If is true, hide all subchilds of .

Parameters
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().

◆ highlightUnusedElement()

void ElementsCollectionWidget::highlightUnusedElement ( )

◆ leaveEvent()

void ElementsCollectionWidget::leaveEvent ( QEvent *  event)
overrideprotected

Definition at line 131 of file elementscollectionwidget.cpp.

References QETApp::diagramEditorAncestorOf().

◆ locationWasSaved()

void ElementsCollectionWidget::locationWasSaved ( const ElementsLocation location)
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.

Parameters
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().

◆ newDirectory()

void ElementsCollectionWidget::newDirectory ( )
private

◆ newElement()

void ElementsCollectionWidget::newElement ( )
private

◆ openDir()

void ElementsCollectionWidget::openDir ( )
private

◆ reload

void ElementsCollectionWidget::reload ( )
slot

◆ removeProject()

void ElementsCollectionWidget::removeProject ( QETProject project)

◆ resetShowThisDir()

void ElementsCollectionWidget::resetShowThisDir ( )
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().

◆ search()

void ElementsCollectionWidget::search ( )
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().

◆ setCurrentLocation()

void ElementsCollectionWidget::setCurrentLocation ( const ElementsLocation location)

◆ setUpAction()

void ElementsCollectionWidget::setUpAction ( )
private

◆ setUpConnection()

void ElementsCollectionWidget::setUpConnection ( )
private

◆ setUpWidget()

void ElementsCollectionWidget::setUpWidget ( )
private

◆ showAndExpandItem()

void ElementsCollectionWidget::showAndExpandItem ( const QModelIndex &  index,
bool  parent = true,
bool  child = false 
)
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.

Parameters
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().

◆ showThisDir()

void ElementsCollectionWidget::showThisDir ( )
private

Member Data Documentation

◆ m_context_menu

QMenu* ElementsCollectionWidget::m_context_menu
private

Definition at line 93 of file elementscollectionwidget.h.

Referenced by customContextMenu(), and setUpWidget().

◆ m_delete_dir

QAction * ElementsCollectionWidget::m_delete_dir
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_delete_element

QAction * ElementsCollectionWidget::m_delete_element
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_dir_propertie

QAction * ElementsCollectionWidget::m_dir_propertie
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_edit_dir

QAction * ElementsCollectionWidget::m_edit_dir
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_edit_element

QAction * ElementsCollectionWidget::m_edit_element
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_first_show

bool ElementsCollectionWidget::m_first_show = true
private

Definition at line 110 of file elementscollectionwidget.h.

◆ m_index_at_context_menu

QModelIndex ElementsCollectionWidget::m_index_at_context_menu
private

◆ m_main_vlayout

QVBoxLayout* ElementsCollectionWidget::m_main_vlayout
private

Definition at line 92 of file elementscollectionwidget.h.

Referenced by setUpWidget().

◆ m_model

ElementsCollectionModel* ElementsCollectionWidget::m_model
private

◆ m_new_directory

QAction * ElementsCollectionWidget::m_new_directory
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_new_element

QAction * ElementsCollectionWidget::m_new_element
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_open_dir

QAction* ElementsCollectionWidget::m_open_dir
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_progress_bar

QProgressBar* ElementsCollectionWidget::m_progress_bar
private

Definition at line 96 of file elementscollectionwidget.h.

Referenced by addProject(), reload(), and setUpWidget().

◆ m_reload

QAction * ElementsCollectionWidget::m_reload
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_search_field

QLineEdit* ElementsCollectionWidget::m_search_field
private

Definition at line 89 of file elementscollectionwidget.h.

Referenced by search(), setUpConnection(), and setUpWidget().

◆ m_search_timer

QTimer ElementsCollectionWidget::m_search_timer
private

Definition at line 90 of file elementscollectionwidget.h.

Referenced by ElementsCollectionWidget(), and setUpConnection().

◆ m_show_all_dir

QAction * ElementsCollectionWidget::m_show_all_dir
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_show_this_dir

QAction * ElementsCollectionWidget::m_show_this_dir
private

Definition at line 98 of file elementscollectionwidget.h.

Referenced by customContextMenu(), setUpAction(), and setUpConnection().

◆ m_showed_index

QModelIndex ElementsCollectionWidget::m_showed_index
private

◆ m_tree_view

ElementsTreeView* ElementsCollectionWidget::m_tree_view
private

◆ m_waiting_project

QList<QETProject *> ElementsCollectionWidget::m_waiting_project
private

Definition at line 111 of file elementscollectionwidget.h.

Referenced by addProject(), and reload().


The documentation for this class was generated from the following files: