Version: 6.3.1
Public Types | Signals | Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes

SUIT_DataBrowser Class Reference

Object browser customization.

#include <SUIT_DataBrowser.h>

Inheritance diagram for SUIT_DataBrowser:
Inheritance graph

Public Types

enum  { UpdateShortcut = 0, RenameShortcut }

Signals

void requestUpdate ()
 The signal is emitted when the key accelerator assigned for the update operation is pressed by the user.
void requestRename ()
void clicked (SUIT_DataObject *)
 This signal is emitted when a mouse button is clicked.
void doubleClicked (SUIT_DataObject *)
 This signal is emitted when a mouse button is double-clicked.
void selectionChanged ()
 Emitted when selection is changed in the Object Browser.

Public Member Functions

 SUIT_DataBrowser (QWidget *=0)
 Constructor.
 SUIT_DataBrowser (SUIT_DataObject *, QWidget *=0)
 Constructor.
 ~SUIT_DataBrowser ()
 Destructor.
virtual QString popupClientType () const
 Get popup menu client type.
SUIT_DataObjectroot () const
 Get root object.
void setRoot (SUIT_DataObject *)
 Set root object.
bool autoUpdate () const
 Get 'auto-update tree' flag value.
void setAutoUpdate (const bool)
 Set 'auto-update tree' flag value.
bool updateModified () const
 Get 'updateModified' flag value.
void setUpdateModified (const bool)
 Set 'updateModified' flag value.
void updateTree (SUIT_DataObject *=0, const bool=true)
 Update object browser starting from the object ; open all branches automatically if autoOpen is true.
int shortcutKey (const int) const
 Get current key accelerator by id.
void setShortcutKey (const int, const int)
 Assign the key accelerator for the shortcut.
DataObjectList getSelected () const
 Get list of selected data objects.
void getSelected (DataObjectList &) const
 Get list of selected data objects.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void setSelected (const SUIT_DataObject *, const bool=false)
 Set selected object.
void setSelected (const DataObjectList &, const bool=false)
 Set list of selected data objects.
virtual void contextMenuPopup (QMenu *)
 Add custom actions to the popup menu.
void setAutoSizeFirstColumn (const bool on)
 Set 'auto-size first column' flag value.
void setAutoSizeColumns (const bool on)
 Set 'auto-size columns' flag value.
void setResizeOnExpandItem (const bool on)
 Set 'resize on expand item' flag value.
QAbstractItemModelmodel () const
 Get data model.
void setModel (QAbstractItemModel *)
 Set data model.
QAbstractItemDelegate * itemDelegate () const
 Get current item delegate (items renderer).
void setItemDelegate (QAbstractItemDelegate *)
 Set item delegate (items renderer).
bool rootIsDecorated () const
 Check if controls for expanding and collapsing top-level items are shown.
void setRootIsDecorated (const bool)
 Show/hide controls for expanding and collapsing top-level items.
bool sortMenuEnabled () const
void setSortMenuEnabled (const bool)
QtxSearchToolsearchTool () const
 Get search tool widget.
bool isSearchToolEnabled () const
 Check if search tool is enabled.
void setSearchToolEnabled (const bool)
 Enable/disable search tool.
int autoOpenLevel () const
 Get number of levels which should be automatically expanded when updating the data tree.
void setAutoOpenLevel (const int)
 Set number of levels which should be automatically expanded when updating the data tree.
void openLevels (const int=-1)
 Expand all branches to the specified number of levels.
int numberOfSelected () const
 Get number of selected items.
QModelIndexList selectedIndexes () const
 Get all selected items.
const QItemSelection selection () const
 Get selection containing information about selected ranges.
virtual void select (const QModelIndex &, const bool, const bool=true)
 Select/deselect specified model index.
virtual void select (const QModelIndexList &, const bool, const bool=true)
 Select/deselect specified model indices.
bool isOpen (const QModelIndex &) const
 Check if specified model index is expanded or collapsed.
virtual void setOpen (const QModelIndex &theObject, const bool theOpen=true)
 Expand/collapse the specified model index.
void adjustWidth ()
 Adjust first column width to its contents.
void adjustFirstColumnWidth ()
 Adjust first column width to its contents.
void adjustColumnsWidth ()
 Adjust all columns width to its contents except the first column.
unsigned long getModifiedTime () const
 Get the time of the latest updating.
void setModified ()
 Update the time of the latest updating.
QtxTreeViewtreeView () const
 Get tree view widget.
bool connectPopupRequest (QObject *reciever, const char *slot)
bool disconnectPopupRequest (QObject *reciever, const char *slot)

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *)
 Process context menu request event.
virtual void createPopupMenu (QMenu *)
 Add custom actions to the popup menu.
void contextMenuRequest (QContextMenuEvent *e)

Private Types

typedef QMap< int, QShortcut * > ShortcutMap

Private Slots

void onModelUpdated ()
 Update internal modification time just after data model update.
void onClicked (const QModelIndex &)
 Called when item is clicked in the tree view.
void onDblClicked (const QModelIndex &)
 Called when item is double-clicked in the tree view.
void onExpanded (const QModelIndex &)
 Called when item specified by index is expanded.
void onStartEditing ()
 Make editable selected item in place.

Private Member Functions

void init (SUIT_DataObject *)
 Initialize object browser.

Private Attributes

ShortcutMap myShortcutMap
bool myAutoSizeFirstColumn
bool myAutoSizeColumns
bool myResizeOnExpandItem

Member Typedef Documentation

typedef QMap<int, QShortcut*> SUIT_DataBrowser.ShortcutMap [private]

Member Enumeration Documentation

anonymous enum
Enumerator:
UpdateShortcut 
RenameShortcut 

Constructor & Destructor Documentation

SUIT_DataBrowser::SUIT_DataBrowser ( QWidget parent = 0)
Parameters:
parentparent widget

References init().

SUIT_DataBrowser::SUIT_DataBrowser ( SUIT_DataObject root,
QWidget parent = 0 
)
Parameters:
rootroot data object
parentparent widget

References init().

SUIT_DataBrowser::~SUIT_DataBrowser ( )

Member Function Documentation

QString SUIT_DataBrowser::popupClientType ( ) const [virtual]
Returns:
popup client type

Implements SUIT_PopupClient.

SUIT_DataObject * SUIT_DataBrowser::root ( ) const
Returns:
root object

References OB_Browser.model(), and SUIT_ProxyModel.root().

void SUIT_DataBrowser::setRoot ( SUIT_DataObject r)
Parameters:
rnew root object

References OB_Browser.model(), and SUIT_ProxyModel.setRoot().

bool SUIT_DataBrowser::autoUpdate ( ) const
Returns:
'auto-update tree' flag value
See also:
setAutoUpdate(), updateTree()

References SUIT_ProxyModel.autoUpdate(), and OB_Browser.model().

void SUIT_DataBrowser::setAutoUpdate ( const bool  on)

If this flag is set to true (by default), the object browser is updated automatically when data tree is changed.

Parameters:
on'auto-update tree' flag value
See also:
autoUpdate(), updateTree()

References OB_Browser.model(), and SUIT_ProxyModel.setAutoUpdate().

bool SUIT_DataBrowser::updateModified ( ) const
Returns:
'updateModified' flag value

References OB_Browser.model(), and SUIT_ProxyModel.updateModified().

void SUIT_DataBrowser::setUpdateModified ( const bool  on)
Parameters:
on'updateModified' flag value

References OB_Browser.model(), and SUIT_ProxyModel.setUpdateModified().

void SUIT_DataBrowser::updateTree ( SUIT_DataObject obj = 0,
const bool  autoOpen = true 
)
Parameters:
objstarting object for updating
autoOpenif true automatically open branches

References OB_Browser.adjustColumnsWidth(), OB_Browser.adjustFirstColumnWidth(), OB_Browser.model(), myAutoSizeColumns, myAutoSizeFirstColumn, OB_Browser.openLevels(), and SUIT_ProxyModel.updateTree().

int SUIT_DataBrowser::shortcutKey ( const int  id) const
Returns:
current key accelerator
See also:
setShortcutKey(), requestUpdate(), requestRename()

References myShortcutMap.

void SUIT_DataBrowser::setShortcutKey ( const int  id,
const int  key 
)
Parameters:
idid of the shortcut
keynew key accelerator
See also:
shortcutKey(), requestUpdate(), requestRename()

References myShortcutMap.

DataObjectList SUIT_DataBrowser::getSelected ( ) const
Returns:
list of the currently selected data objects
void SUIT_DataBrowser::getSelected ( DataObjectList lst) const
Parameters:
lstlist to be filled with the currently selected data objects

References OB_Browser.model(), PyInterp.obj, SUIT_ProxyModel.object(), and OB_Browser.selectedIndexes().

void SUIT_DataBrowser::setSelected ( const SUIT_DataObject obj,
const bool  append = false 
)
Parameters:
objdata object to set selected
appendif true, the object is added to the current selection; otherwise the previous selection is first cleared

References SUIT_ProxyModel.index(), OB_Browser.model(), and OB_Browser.select().

void SUIT_DataBrowser::setSelected ( const DataObjectList lst,
const bool  append = false 
)
Parameters:
lstlist of the data object to set selected
appendif true, the objects are added to the current selection; otherwise the previous selection is first cleared

References SUIT_ProxyModel.index(), OB_Browser.model(), modelIndexLessThan(), PyInterp.obj, and OB_Browser.select().

void SUIT_DataBrowser::contextMenuPopup ( QMenu menu) [virtual]
Parameters:
menupopup menu

Reimplemented from SUIT_PopupClient.

References OB_Browser.createPopupMenu().

void SUIT_DataBrowser::setAutoSizeFirstColumn ( const bool  on)

If this flag is set to true (by default), the first column width is resized to its contents.

Parameters:
on'auto-size first column' flag value
See also:
setAutoSizeColumns()

References myAutoSizeFirstColumn.

void SUIT_DataBrowser::setAutoSizeColumns ( const bool  on)

If this flag is set to true (by default is false), columns width except the first column is resized to its contents.

Parameters:
on'auto-size columns' flag value
See also:
setAutoSizeFirstColumn()

References myAutoSizeColumns.

void SUIT_DataBrowser::setResizeOnExpandItem ( const bool  on)

If this flag is set to true (by default is false), after expanding an item columns will be resized to its contents.

Parameters:
on'resize on expand item' flag value

References myResizeOnExpandItem.

void SUIT_DataBrowser::contextMenuEvent ( QContextMenuEvent *  e) [protected, virtual]
Parameters:
econtext menu event

Reimplemented from OB_Browser.

References SUIT_PopupClient.contextMenuRequest().

void SUIT_DataBrowser::init ( SUIT_DataObject root) [private]
void SUIT_DataBrowser::requestUpdate ( ) [signal]

By default, [F5] key is assigned for the update operation. The key accelerator can be changed with the setShortcutKey() method.

See also:
shortcutKey(), setShortcutKey()
void SUIT_DataBrowser.requestRename ( ) [signal]
void SUIT_DataBrowser::clicked ( SUIT_DataObject o) [signal]

The data object the mouse was clicked on is specified by o. The signal is only emitted when the object is valid.

Parameters:
odata object which is clicked
void SUIT_DataBrowser::doubleClicked ( SUIT_DataObject o) [signal]

The data object the mouse was double-clicked on is specified by o. The signal is only emitted when the object is valid.

Parameters:
odata object which is double-clicked
void SUIT_DataBrowser::onModelUpdated ( ) [private, slot]
void SUIT_DataBrowser::onClicked ( const QModelIndex &  index) [private, slot]
void SUIT_DataBrowser::onDblClicked ( const QModelIndex &  index) [private, slot]
void SUIT_DataBrowser::onExpanded ( const QModelIndex &  index) [private, slot]
void SUIT_DataBrowser::onStartEditing ( ) [private, slot]
QAbstractItemModel * OB_Browser::model ( ) const [inherited]
Returns:
data model
See also:
setModel()

References OB_Browser.myView.

void OB_Browser::setModel ( QAbstractItemModel model) [inherited]
Parameters:
modeldata model
See also:
model()

References OB_Browser.myView, QtxTreeView.setModel(), and OB_Browser.setModified().

QAbstractItemDelegate * OB_Browser::itemDelegate ( ) const [inherited]
Returns:
currently used item delegate
See also:
setItemDelegate()

References OB_Browser.myView.

void OB_Browser::setItemDelegate ( QAbstractItemDelegate *  d) [inherited]
Parameters:
dcustom item delegate
See also:
itemDelegate()

References OB_Browser.myView.

bool OB_Browser::rootIsDecorated ( ) const [inherited]
Returns:
true if top-level items are decorated
See also:
setRootIsDecorated()

References OB_Browser.myView.

void OB_Browser::setRootIsDecorated ( const bool  decor) [inherited]
Parameters:
decorif true, top-level items are decorated
See also:
rootIsDecorated()

References OB_Browser.myView, and OB_Browser.rootIsDecorated().

bool OB_Browser::sortMenuEnabled ( ) const [inherited]
void OB_Browser::setSortMenuEnabled ( const bool  enabled) [inherited]
QtxSearchTool * OB_Browser::searchTool ( ) const [inherited]
Returns:
search tool widget
See also:
isSearchToolEnabled(), setSearchToolEnabled()

References OB_Browser.mySearchTool.

bool OB_Browser::isSearchToolEnabled ( ) const [inherited]
Returns:
true if search tool is enabled
See also:
setSearchToolEnabled(), searchTool()

References OB_Browser.mySearchTool.

void OB_Browser::setSearchToolEnabled ( const bool  enable) [inherited]
Parameters:
enablepass true to enable search tool
See also:
isSearchToolEnabled(), searchTool()

References OB_Browser.mySearchTool.

int OB_Browser::autoOpenLevel ( ) const [inherited]
Returns:
number of levels to be auto-opened on tree updating
See also:
setAutoOpenLevel()

References OB_Browser.myAutoOpenLevel.

void OB_Browser::setAutoOpenLevel ( const int  levels) [inherited]
Parameters:
levelsnumber of levels to be auto-opened on tree updating
See also:
autoOpenLevel()

References OB_Browser.myAutoOpenLevel.

void OB_Browser::openLevels ( const int  levels = -1) [inherited]

If levels value is negative, then autoOpenLevel() value is used instead.

Parameters:
levelsnumber of levels to be expanded
See also:
autoOpenLevel()

References OB_Browser.autoOpenLevel(), QtxTreeView.expandLevels(), and OB_Browser.myView.

int OB_Browser::numberOfSelected ( ) const [inherited]
Returns:
state "are tooltips shown"

Sets new value of state "are tooltips shown"

Parameters:
theDisplay- new value
Returns:
number of selected items

References OB_Browser.myView.

QModelIndexList OB_Browser::selectedIndexes ( ) const [inherited]
Returns:
unsorted list of selected indexes with no duplicates

References OB_Browser.myView.

const QItemSelection OB_Browser::selection ( ) const [inherited]
Returns:
QItemSelection instance

References OB_Browser.myView.

void OB_Browser::select ( const QModelIndex &  index,
const bool  on,
const bool  keepSelection = true 
) [virtual, inherited]
Parameters:
indexmodel index to be selected/deselected
onif true, the index will be selected, otherwise - deselected
keepSelectionif true (default) the previous selection is kept, otherwise it is first cleared

References OB_Browser.myView.

void OB_Browser::select ( const QModelIndexList &  indexes,
const bool  on,
const bool  keepSelection = true 
) [virtual, inherited]
Parameters:
indexesmodel indices to be selected/deselected
onif true, the indices will be selected, otherwise - deselected
keepSelectionif true (default) the previous selection is kept, otherwise it is first cleared

References OB_Browser.myView, and OB_Browser.selectionChanged().

bool OB_Browser::isOpen ( const QModelIndex &  index) const [inherited]
Parameters:
indexmodel index
Returns:
true if model index is expanded
See also:
setOpen()

References OB_Browser.model(), and OB_Browser.myView.

void OB_Browser::setOpen ( const QModelIndex &  index,
const bool  open = true 
) [virtual, inherited]
Parameters:
indexmodel index
openif true, the index will be expanded, otherwse - collapsed
See also:
isOpen()

References OB_Browser.myView.

void OB_Browser::adjustWidth ( ) [inherited]
void OB_Browser::adjustFirstColumnWidth ( ) [inherited]
void OB_Browser::adjustColumnsWidth ( ) [inherited]
unsigned long OB_Browser::getModifiedTime ( ) const [inherited]
Returns:
latest updating time

References OB_Browser.myModifiedTime.

void OB_Browser::setModified ( ) [inherited]
QtxTreeView * OB_Browser::treeView ( ) const [inherited]
Returns:
SUIT object correspondint to item at position 'pos'
Parameters:
pos- position
Returns:
filter of list view

Changes filter of list view

Parameters:
f- new filter

Sets global width mode

Parameters:
mode- new width mode

Updates tree

Parameters:
obj- start object
autoOpen- to open automatically branches of autoOpenLevel()
See also:
autoOpenLevel()

Replaces part of tree starting at object 'src' by tree starting at object 'trg'

Adjusts width by item

Parameters:
item

all items referencing current (through data objects)

Connects all children to SLOT onDestroyed

Disconnects all children from SLOT onDestroyed

Stores states (opened, selected) of current tree items

Returns:
current item
Parameters:
selObjs,selKeys- maps of selected objects
openObjs,openKeys- maps of opened objects
curKey- map of current objects

Restores states (opened, selected) of current tree items

Parameters:
selObjs,selKeys- maps of selected objects
openObjs,openKeys- maps of opened objects
curKey- map of current objects

Creates object key by tree item

Creates object key by SUIT object

Returns:
tree view widget of the object browser

References OB_Browser.myView.

void OB_Browser::selectionChanged ( ) [signal, inherited]

Removes SUIT object

Parameters:
obj- SUIT object to be removed
autoUpd- auto tree updating

Opens branches from 1 to autoOpenLevel()

See also:
autoOpenLevel()

Opens branch

Parameters:
item
level

SLOT: called on double click on item, emits signal

void OB_Browser::createPopupMenu ( QMenu menu) [protected, virtual, inherited]

SLOT: called if SUIT object is destroyed

SLOT: called on finish of drag-n-drop operation

Parameters:
items- dragged items
item- destination (item on that they were dropped)
action- QDropEvent.Action

Updates texts of items

Returns:
true if item must be updated
Parameters:
item- item to be checked

Updates texts of item

Parameters:
item- item to be updated
menupopup menu

References OB_Browser.hasCollased(), OB_Browser.hasExpanded(), OB_Browser.isSearchToolEnabled(), OB_Browser.onCollapseAll(), OB_Browser.onExpandAll(), OB_Browser.searchTool(), and OB_Browser.selectedIndexes().

bool SUIT_PopupClient::connectPopupRequest ( QObject reciever,
const char *  slot 
) [inherited]

Connect popup request.

References SUIT_PopupClient.contextMenuRequest(), and SUIT_PopupClient.mySignal.

bool SUIT_PopupClient::disconnectPopupRequest ( QObject reciever,
const char *  slot 
) [inherited]

Disconnect popup request.

References SUIT_PopupClient.contextMenuRequest(), and SUIT_PopupClient.mySignal.

void SUIT_PopupClient::contextMenuRequest ( QContextMenuEvent *  e) [protected, inherited]

Send signal on context menu request.

References SUIT_PopupClient.mySignal, and SUIT_PopupClient.Signal.sendSignal().


Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS