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

This widget allows allows to browse the treeview in a special way. More...

#include <TreeBrowser.hpp>

Inherits QWidget.

Public Slots

void focus_filter ()
 

Public Member Functions

 TreeBrowser (TreeView *view, QWidget *parent=0)
 Constructor. More...
 
 ~TreeBrowser ()
 Destructor. More...
 

Private Slots

void previous_clicked ()
 Slot called when user clicks on the previous button. The current index is decreased by one and the treeview is updated. More...
 
void next_clicked ()
 Slot called when user clicks on the next button. The current index is increased by one and the treeview is updated. More...
 
void double_clicked (const QModelIndex &index)
 Slot called when user double-clicks on a node. More...
 
void action_triggered ()
 Slot called when a menu item is clicked. More...
 
void filter_updated (const QString &text)
 

Private Member Functions

void update_buttons ()
 Updates buttons "enabled" state and rebuilds the menus. More...
 

Private Attributes

TreeViewm_tree_view
 The observed treeview. More...
 
QToolButton * m_bt_previous
 Previous button. More...
 
QToolButton * m_bt_next
 Next button. More...
 
QList< QPersistentModelIndex > m_history
 The history. More...
 
QLineEdit * m_filter
 
QMap< QAction *, int > m_actions
 Menu actions. More...
 
int m_current_index
 The current index. More...
 
QGridLayout * m_buttons_layout
 Buttons layout. More...
 
QVBoxLayout * m_main_layout
 Main layout. More...
 
QMenu * m_menu_previous
 The menu for the previous button. More...
 
QMenu * m_menu_next
 The menu for the next button. More...
 

Detailed Description

This widget allows allows to browse the treeview in a special way.

Each time a user double-clicks on an node, it becomes the new treeview root, thus only its children are visible.
The hitory is maintained as a list of QPersistentModelIndex, in which the last item is the last node the user clicked on. An integer value, constantly indicates the current root index in the tree.
The widget provides two buttons: one to go backward (decrease the current index by 1) through the history, and another one to go forward (increase the current index by 1). "Back" and "Forward" direction are represented as black arrows (grayed when button is disabled).
Each button provides a menu that allows to jump over more than one item in one click. The "back" menu displays all paths that are older than the current index in the history. The "forward" menu displays those that are newer. The current index is never displayed in the menus.
Each time the tree is double-clicked, the node on which user clicked is appended to the history. If the current index is not the last item in the history, all items after it are removed before the new one is inserted. This is to make sure that the new item is the last of the list and is directly after the current index in the history. After insterting, the new item becomes the current index.

Definition at line 67 of file TreeBrowser.hpp.

Constructor & Destructor Documentation

TreeBrowser ( TreeView view,
QWidget *  parent = 0 
)

Constructor.

Parameters
viewThe observed treeview. Can not be nullptr.
parentWidget parent.

Definition at line 35 of file TreeBrowser.cpp.

Destructor.

Frees all allocated memory. The treeview and the parent are not deleted.

Definition at line 84 of file TreeBrowser.cpp.

Member Function Documentation

void action_triggered ( )
privateslot

Slot called when a menu item is clicked.

Definition at line 147 of file TreeBrowser.cpp.

void double_clicked ( const QModelIndex &  index)
privateslot

Slot called when user double-clicks on a node.

Definition at line 133 of file TreeBrowser.cpp.

void filter_updated ( const QString &  text)
privateslot

Definition at line 161 of file TreeBrowser.cpp.

void focus_filter ( )
slot

Definition at line 97 of file TreeBrowser.cpp.

void next_clicked ( )
privateslot

Slot called when user clicks on the next button. The current index is increased by one and the treeview is updated.

Definition at line 122 of file TreeBrowser.cpp.

void previous_clicked ( )
privateslot

Slot called when user clicks on the previous button. The current index is decreased by one and the treeview is updated.

Definition at line 104 of file TreeBrowser.cpp.

void update_buttons ( )
private

Updates buttons "enabled" state and rebuilds the menus.

Definition at line 168 of file TreeBrowser.cpp.

Member Data Documentation

QMap<QAction *, int> m_actions
private

Menu actions.

The key is the action. The value is the index of the corresponding index.

Definition at line 127 of file TreeBrowser.hpp.

QToolButton* m_bt_next
private

Next button.

Definition at line 116 of file TreeBrowser.hpp.

QToolButton* m_bt_previous
private

Previous button.

Definition at line 113 of file TreeBrowser.hpp.

QGridLayout* m_buttons_layout
private

Buttons layout.

Definition at line 134 of file TreeBrowser.hpp.

int m_current_index
private

The current index.

Definition at line 130 of file TreeBrowser.hpp.

QLineEdit* m_filter
private

Definition at line 121 of file TreeBrowser.hpp.

QList<QPersistentModelIndex> m_history
private

The history.

Definition at line 119 of file TreeBrowser.hpp.

QVBoxLayout* m_main_layout
private

Main layout.

Definition at line 137 of file TreeBrowser.hpp.

QMenu* m_menu_next
private

The menu for the next button.

Definition at line 143 of file TreeBrowser.hpp.

QMenu* m_menu_previous
private

The menu for the previous button.

Definition at line 140 of file TreeBrowser.hpp.

TreeView* m_tree_view
private

The observed treeview.

Definition at line 110 of file TreeBrowser.hpp.


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