COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
TreeView Class Reference

This class manages the tree view. More...

#include <TreeView.hpp>

Inherits QTreeView.

Signals

void item_double_clicked (const QModelIndex &index)
 

Public Member Functions

 TreeView (CentralPanel *optionsPanel, QMainWindow *parent=nullptr, bool contextMenuAllowed=true)
 Constructor. More...
 
 ~TreeView ()
 Destructor. More...
 
void set_read_only (bool readOnly)
 Changes the read-only mode. More...
 
bool is_read_only () const
 Indicates whether the tree m_view is in read-only mode or not. More...
 
common::URI selected_path () const
 
common::URI path_from_index (const QModelIndex &index)
 
QIcon icon_from_index (const QModelIndex &index)
 
void select_item (const cf3::common::URI &path)
 
void set_filter (const QString &pattern)
 
bool try_commit ()
 

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *event)
 Method called when a mouse button is pressed in the Client. More...
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 

Private Slots

void current_index_changed (const QModelIndex &newIndex, const QModelIndex &oldIndex)
 

Private Member Functions

bool confirm_change_options (const QModelIndex &index, bool okIfSameIndex=false)
 Asks user to commit or rollback before changing options() in options() panel. More...
 

Private Attributes

CentralPanelm_central_panel
 Panel used to display and modify options() for a selected object. More...
 
QStringList m_abstract_types
 List of abstract types. More...
 
FilteringModelm_model_filter
 Filter for the Client. More...
 
bool m_read_only
 Indicates whether the tree m_view is in read-only mode or not. More...
 
SignalManagerm_signal_manager
 
bool m_context_menu_allowed
 

Detailed Description

This class manages the tree view.

Author
Gasper Quentin

Definition at line 46 of file TreeView.hpp.

Constructor & Destructor Documentation

TreeView ( CentralPanel optionsPanel,
QMainWindow *  parent = nullptr,
bool  contextMenuAllowed = true 
)

Constructor.

Parameters
optionsPanelPanel options() of the selected node will be displayed.
parentParent window. May be nullptr.
Exceptions
std::invalid_argumentif optionsPanel is nullptr.

Definition at line 41 of file TreeView.cpp.

~TreeView ( )

Destructor.

Frees all allocated memory. Neither the options() panel nor the parent are destroyed.

Definition at line 79 of file TreeView.cpp.

Member Function Documentation

bool confirm_change_options ( const QModelIndex &  index,
bool  okIfSameIndex = false 
)
private

Asks user to commit or rollback before changing options() in options() panel.

If modifications were committed, nothing is asked and the method immediately returns true. If the commit is requested by the user, it is processed by this method.

Parameters
indexNode index on which user clicked. If it is equals to #currentIndexInPanel nothing is asked and the method immediately returns true.
okIfSameIndexIf false, the method checks if indexes are the same. If true, no check is done.
Returns
Returns false if the user clicked on "Cancel" ; otherwise returns true.

Definition at line 266 of file TreeView.cpp.

void current_index_changed ( const QModelIndex &  newIndex,
const QModelIndex &  oldIndex 
)
privateslot

Definition at line 295 of file TreeView.cpp.

QIcon icon_from_index ( const QModelIndex &  index)

Definition at line 124 of file TreeView.cpp.

bool is_read_only ( ) const

Indicates whether the tree m_view is in read-only mode or not.

Returns
Returns true if the tree m_view is in read-only mode. Otherwise, returns false.

Definition at line 93 of file TreeView.cpp.

void item_double_clicked ( const QModelIndex &  index)
signal
void keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Definition at line 227 of file TreeView.cpp.

void mouseDoubleClickEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 219 of file TreeView.cpp.

void mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Method called when a mouse button is pressed in the Client.

This method overloads parent class method. Four cases are possible :

  • If user right-clicks, a context menu is displayed.
  • If user left-clicks on another node than the currently selected one and confirmChangeOptions() returns true, options() in the options() panel are changed.
  • If user left-clicks on the selected node nothing is done.
  • Middle button has no effect.
    Parameters
    eventEvent that occured.

Definition at line 175 of file TreeView.cpp.

URI path_from_index ( const QModelIndex &  index)

Definition at line 117 of file TreeView.cpp.

void select_item ( const cf3::common::URI path)

Definition at line 132 of file TreeView.cpp.

URI selected_path ( ) const

Definition at line 100 of file TreeView.cpp.

void set_filter ( const QString &  pattern)

Definition at line 151 of file TreeView.cpp.

void set_read_only ( bool  readOnly)

Changes the read-only mode.

Parameters
readOnlyIf true, the tree m_view will switch to the read-only mode.

Definition at line 86 of file TreeView.cpp.

bool try_commit ( )

Definition at line 160 of file TreeView.cpp.

Member Data Documentation

QStringList m_abstract_types
private

List of abstract types.

Definition at line 123 of file TreeView.hpp.

CentralPanel* m_central_panel
private

Panel used to display and modify options() for a selected object.

Definition at line 120 of file TreeView.hpp.

bool m_context_menu_allowed
private

Definition at line 141 of file TreeView.hpp.

FilteringModel* m_model_filter
private

Filter for the Client.

Allows to switch between basic/advanced mode. The filter is used as the Client model. Its source is the tree model.

Definition at line 129 of file TreeView.hpp.

bool m_read_only
private

Indicates whether the tree m_view is in read-only mode or not.

If true, the tree m_view is read-only mode. When it is read-only mode, all options() in the context that may modify an object are disbaled. "Delete", "Rename", "Add a child node" and "Add an option" m_items are then disabled.

Definition at line 137 of file TreeView.hpp.

SignalManager* m_signal_manager
private

Definition at line 139 of file TreeView.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin