COOLFluiD
Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
|
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 | |
TreeView * | m_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... | |
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.
TreeBrowser | ( | TreeView * | view, |
QWidget * | parent = 0 |
||
) |
Constructor.
view | The observed treeview. Can not be nullptr . |
parent | Widget parent. |
Definition at line 35 of file TreeBrowser.cpp.
~TreeBrowser | ( | ) |
Destructor.
Frees all allocated memory. The treeview and the parent are not deleted.
Definition at line 84 of file TreeBrowser.cpp.
|
privateslot |
Slot called when a menu item is clicked.
Definition at line 147 of file TreeBrowser.cpp.
|
privateslot |
Slot called when user double-clicks on a node.
Definition at line 133 of file TreeBrowser.cpp.
|
privateslot |
Definition at line 161 of file TreeBrowser.cpp.
|
slot |
Definition at line 97 of file TreeBrowser.cpp.
|
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.
|
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.
|
private |
Updates buttons "enabled" state and rebuilds the menus.
Definition at line 168 of file TreeBrowser.cpp.
|
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.
|
private |
Next button.
Definition at line 116 of file TreeBrowser.hpp.
|
private |
Previous button.
Definition at line 113 of file TreeBrowser.hpp.
|
private |
Buttons layout.
Definition at line 134 of file TreeBrowser.hpp.
|
private |
The current index.
Definition at line 130 of file TreeBrowser.hpp.
|
private |
Definition at line 121 of file TreeBrowser.hpp.
|
private |
The history.
Definition at line 119 of file TreeBrowser.hpp.
|
private |
Main layout.
Definition at line 137 of file TreeBrowser.hpp.
|
private |
The menu for the next button.
Definition at line 143 of file TreeBrowser.hpp.
|
private |
The menu for the previous button.
Definition at line 140 of file TreeBrowser.hpp.
|
private |
The observed treeview.
Definition at line 110 of file TreeBrowser.hpp.
Send comments to: COOLFluiD Web Admin |