Version: 9.12.0
SUIT_DataBrowser Class Reference

Object browser customization. More...

#include <SUIT_DataBrowser.h>

Inheritance diagram for SUIT_DataBrowser:
Inheritance graph

Public Types

enum  { UpdateShortcut = 0 , RenameShortcut }
 
- Public Types inherited from OB_Browser
typedef QMap< QString, bool > MapOfOpenStates
 

Signals

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

Public Member Functions

 SUIT_DataBrowser (QWidget *=0)
 Constructor. More...
 
 SUIT_DataBrowser (SUIT_DataObject *, QWidget *=0)
 Constructor. More...
 
 ~SUIT_DataBrowser ()
 Destructor. More...
 
virtual QString popupClientType () const
 Get popup menu client type. More...
 
SUIT_DataObjectroot () const
 Get root object. More...
 
void setRoot (SUIT_DataObject *)
 Set root object. More...
 
bool autoUpdate () const
 Get 'auto-update tree' flag value. More...
 
void setAutoUpdate (const bool)
 Set 'auto-update tree' flag value. More...
 
bool updateModified () const
 Get 'updateModified' flag value. More...
 
void setUpdateModified (const bool)
 Set 'updateModified' flag value. More...
 
void updateTree (SUIT_DataObject *=0, const bool=true)
 Update object browser starting from the object \obj; open all branches automatically if autoOpen is true. More...
 
int shortcutKey (const int) const
 Get current key accelerator by id. More...
 
void setShortcutKey (const int, const int)
 Assign the key accelerator for the shortcut. More...
 
DataObjectList getSelected () const
 Get list of selected data objects. More...
 
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. More...
 
void setSelected (const SUIT_DataObject *, const bool=false)
 Set selected object. More...
 
void setSelected (const DataObjectList &, const bool=false)
 Set list of selected data objects. More...
 
virtual void contextMenuPopup (QMenu *)
 Add custom actions to the popup menu. More...
 
void setAutoSizeFirstColumn (const bool on)
 Set 'auto-size first column' flag value. More...
 
void setAutoSizeColumns (const bool on)
 Set 'auto-size columns' flag value. More...
 
void setResizeOnExpandItem (const bool on)
 Set 'resize on expand item' flag value. More...
 
void ensureVisible (SUIT_DataObject *)
 Make the view item for specified data object is visible. More...
 
void ensureVisible (const DataObjectList &)
 Make the view items for specified data objects is visible. More...
 
- Public Member Functions inherited from OB_Browser
 OB_Browser (QWidget *=0, QAbstractItemModel *=0)
 Constructor. More...
 
virtual ~OB_Browser ()
 Destructor. More...
 
QAbstractItemModelmodel () const
 Get data model. More...
 
void setModel (QAbstractItemModel *)
 Set data model. More...
 
QAbstractItemDelegate * itemDelegate () const
 Get current item delegate (items renderer). More...
 
void setItemDelegate (QAbstractItemDelegate *)
 Set item delegate (items renderer). More...
 
bool rootIsDecorated () const
 Check if controls for expanding and collapsing top-level items are shown. More...
 
void setRootIsDecorated (const bool)
 Show/hide controls for expanding and collapsing top-level items. More...
 
bool sortMenuEnabled () const
 
void setSortMenuEnabled (const bool)
 
QtxSearchToolsearchTool () const
 Get search tool widget. More...
 
bool isSearchToolEnabled () const
 Check if search tool is enabled. More...
 
void setSearchToolEnabled (const bool)
 Enable/disable search tool. More...
 
int autoOpenLevel () const
 Get number of levels which should be automatically expanded when updating the data tree. More...
 
void setAutoOpenLevel (const int)
 Set number of levels which should be automatically expanded when updating the data tree. More...
 
void openLevels (const int=-1)
 Expand all branches to the specified number of levels. More...
 
int numberOfSelected () const
 Get number of selected items. More...
 
QModelIndexList selectedIndexes () const
 Get all selected items. More...
 
const QItemSelection selection () const
 Get selection containing information about selected ranges. More...
 
virtual void select (const QModelIndex &, const bool, const bool=true)
 Select/deselect specified model index. More...
 
virtual void select (const QModelIndexList &, const bool, const bool=true)
 Select/deselect specified model indices. More...
 
bool isOpen (const QModelIndex &) const
 Check if specified model index is expanded or collapsed. More...
 
virtual void setOpen (const QModelIndex &theObject, const bool theOpen=true)
 Expand/collapse the specified model index. More...
 
void adjustWidth ()
 Adjust first column width to its contents. More...
 
void adjustFirstColumnWidth ()
 Adjust first column width to its contents. More...
 
void adjustColumnsWidth ()
 Adjust all columns width to its contents except the first column. More...
 
unsigned long getModifiedTime () const
 Get the time of the latest updating. More...
 
void setModified ()
 Update the time of the latest updating. More...
 
QtxTreeViewtreeView () const
 Get tree view widget. More...
 
QByteArray getOpenStates (int theColumn) const
 
void setOpenStates (const QByteArray &, int theColumn)
 
void openStates (bool isGet, MapOfOpenStates &, const QModelIndex &theIndex, int theColumn)
 
- Public Member Functions inherited from SUIT_PopupClient
 SUIT_PopupClient ()
 
virtual ~SUIT_PopupClient ()
 
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. More...
 
- Protected Member Functions inherited from OB_Browser
virtual void createPopupMenu (QMenu *)
 Add custom actions to the popup menu. More...
 
- Protected Member Functions inherited from SUIT_PopupClient
void contextMenuRequest (QContextMenuEvent *e)
 

Private Types

typedef QMap< int, QShortcut * > ShortcutMap
 

Private Slots

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

Private Member Functions

void init (SUIT_DataObject *)
 Initialize object browser. More...
 

Private Attributes

ShortcutMap myShortcutMap
 
bool myAutoSizeFirstColumn
 
bool myAutoSizeColumns
 
bool myResizeOnExpandItem
 

Detailed Description

Object browser customization.

Member Typedef Documentation

◆ ShortcutMap

typedef QMap<int, QShortcut*> SUIT_DataBrowser::ShortcutMap
private

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
UpdateShortcut 
RenameShortcut 

Constructor & Destructor Documentation

◆ SUIT_DataBrowser() [1/2]

SUIT_DataBrowser::SUIT_DataBrowser ( QWidget parent = 0)

Constructor.

Parameters
parentparent widget

References init().

◆ SUIT_DataBrowser() [2/2]

SUIT_DataBrowser::SUIT_DataBrowser ( SUIT_DataObject root,
QWidget parent = 0 
)

Constructor.

Parameters
rootroot data object
parentparent widget

References init(), and root().

◆ ~SUIT_DataBrowser()

SUIT_DataBrowser::~SUIT_DataBrowser ( )

Destructor.

Member Function Documentation

◆ autoUpdate()

bool SUIT_DataBrowser::autoUpdate ( ) const

Get 'auto-update tree' flag value.

Returns
'auto-update tree' flag value
See also
setAutoUpdate(), updateTree()

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

◆ clicked

void SUIT_DataBrowser::clicked ( SUIT_DataObject o)
signal

This signal is emitted when a mouse button is clicked.

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

◆ contextMenuEvent()

void SUIT_DataBrowser::contextMenuEvent ( QContextMenuEvent *  e)
protectedvirtual

Process context menu request event.

Parameters
econtext menu event

Reimplemented from OB_Browser.

References SUIT_PopupClient::contextMenuRequest().

◆ contextMenuPopup()

void SUIT_DataBrowser::contextMenuPopup ( QMenu menu)
virtual

Add custom actions to the popup menu.

Parameters
menupopup menu

Reimplemented from SUIT_PopupClient.

References OB_Browser::createPopupMenu().

◆ doubleClicked

void SUIT_DataBrowser::doubleClicked ( SUIT_DataObject o)
signal

This signal is emitted when a mouse button is double-clicked.

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

◆ ensureVisible() [1/2]

void SUIT_DataBrowser::ensureVisible ( const DataObjectList lst)

Make the view items for specified data objects is visible.

Parameters
lstdata object list

References SUIT_AbstractModel::index(), OB_Browser::model(), QtxTreeView::scrollTo(), and OB_Browser::treeView().

◆ ensureVisible() [2/2]

void SUIT_DataBrowser::ensureVisible ( SUIT_DataObject obj)

Make the view item for specified data object is visible.

Parameters
objdata object

◆ getSelected() [1/2]

DataObjectList SUIT_DataBrowser::getSelected ( ) const

Get list of selected data objects.

Returns
list of the currently selected data objects

◆ getSelected() [2/2]

void SUIT_DataBrowser::getSelected ( DataObjectList lst) 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.

Parameters
lstlist to be filled with the currently selected data objects

References OB_Browser::model(), SUIT_ProxyModel::object(), and OB_Browser::selectedIndexes().

◆ init()

◆ onClicked

void SUIT_DataBrowser::onClicked ( const QModelIndex &  index)
privateslot

Called when item is clicked in the tree view.

Emits signal clicked( SUIT_DataObject* );

References clicked(), SUIT_ProxyModel::emitClicked(), OB_Browser::model(), and SUIT_ProxyModel::object().

◆ onDblClicked

void SUIT_DataBrowser::onDblClicked ( const QModelIndex &  index)
privateslot

Called when item is double-clicked in the tree view.

Emits signal doubleClicked( SUIT_DataObject* );

References doubleClicked(), OB_Browser::model(), and SUIT_ProxyModel::object().

◆ onExpanded

void SUIT_DataBrowser::onExpanded ( const QModelIndex &  )
privateslot

Called when item specified by index is expanded.

References OB_Browser::adjustColumnsWidth(), OB_Browser::adjustFirstColumnWidth(), and myResizeOnExpandItem.

◆ onModelUpdated

void SUIT_DataBrowser::onModelUpdated ( )
privateslot

Update internal modification time just after data model update.

References OB_Browser::setModified().

◆ onStartEditing

void SUIT_DataBrowser::onStartEditing ( )
privateslot

◆ popupClientType()

QString SUIT_DataBrowser::popupClientType ( ) const
virtual

Get popup menu client type.

Returns
popup client type

Implements SUIT_PopupClient.

◆ requestRename

void SUIT_DataBrowser::requestRename ( )
signal

◆ requestUpdate

void SUIT_DataBrowser::requestUpdate ( )
signal

The signal is emitted when the key accelerator assigned for the update operation is pressed by the user.

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

See also
shortcutKey(), setShortcutKey()

◆ root()

SUIT_DataObject * SUIT_DataBrowser::root ( ) const

Get root object.

Returns
root object

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

◆ setAutoSizeColumns()

void SUIT_DataBrowser::setAutoSizeColumns ( const bool  on)

Set 'auto-size columns' flag value.

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.

◆ setAutoSizeFirstColumn()

void SUIT_DataBrowser::setAutoSizeFirstColumn ( const bool  on)

Set 'auto-size first column' flag value.

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.

◆ setAutoUpdate()

void SUIT_DataBrowser::setAutoUpdate ( const bool  on)

Set 'auto-update tree' flag value.

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

◆ setResizeOnExpandItem()

void SUIT_DataBrowser::setResizeOnExpandItem ( const bool  on)

Set 'resize on expand item' flag value.

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.

◆ setRoot()

void SUIT_DataBrowser::setRoot ( SUIT_DataObject r)

Set root object.

Parameters
rnew root object

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

◆ setSelected() [1/2]

void SUIT_DataBrowser::setSelected ( const DataObjectList lst,
const bool  append = false 
)

Set list of selected data objects.

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(), and OB_Browser::select().

◆ setSelected() [2/2]

void SUIT_DataBrowser::setSelected ( const SUIT_DataObject obj,
const bool  append = false 
)

Set selected object.

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

◆ setShortcutKey()

void SUIT_DataBrowser::setShortcutKey ( const int  id,
const int  key 
)

Assign the key accelerator for the shortcut.

Parameters
idid of the shortcut
keynew key accelerator
See also
shortcutKey(), requestUpdate(), requestRename()

References myShortcutMap.

◆ setUpdateModified()

void SUIT_DataBrowser::setUpdateModified ( const bool  on)

Set 'updateModified' flag value.

Parameters
on'updateModified' flag value

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

◆ shortcutKey()

int SUIT_DataBrowser::shortcutKey ( const int  id) const

Get current key accelerator by id.

Returns
current key accelerator
See also
setShortcutKey(), requestUpdate(), requestRename()

References myShortcutMap.

◆ updated

void SUIT_DataBrowser::updated ( )
signal

◆ updateModified()

bool SUIT_DataBrowser::updateModified ( ) const

Get 'updateModified' flag value.

Returns
'updateModified' flag value

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

◆ updateTree()

void SUIT_DataBrowser::updateTree ( SUIT_DataObject obj = 0,
const bool  = true 
)

Update object browser starting from the object \obj; open all branches automatically if autoOpen is 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(), updated(), and SUIT_ProxyModel::updateTree().

Member Data Documentation

◆ myAutoSizeColumns

bool SUIT_DataBrowser::myAutoSizeColumns
private

◆ myAutoSizeFirstColumn

bool SUIT_DataBrowser::myAutoSizeFirstColumn
private

◆ myResizeOnExpandItem

bool SUIT_DataBrowser::myResizeOnExpandItem
private

◆ myShortcutMap

ShortcutMap SUIT_DataBrowser::myShortcutMap
private

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