Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SUIT_DataBrowser Class Reference

Object browser customization.

#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 ; 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
 

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

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::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::contextMenuEvent ( QContextMenuEvent *  e)
protectedvirtual
Parameters
econtext menu event

Reimplemented from OB_Browser.

References SUIT_PopupClient::contextMenuRequest().

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

Reimplemented from SUIT_PopupClient.

References OB_Browser::createPopupMenu().

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::ensureVisible ( SUIT_DataObject obj)
Parameters
objdata object
void SUIT_DataBrowser::ensureVisible ( const DataObjectList lst)
Parameters
lstdata object list

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

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(), obj, SUIT_ProxyModel::object(), and OB_Browser::selectedIndexes().

void SUIT_DataBrowser::onClicked ( const QModelIndex &  index)
privateslot
void SUIT_DataBrowser::onDblClicked ( const QModelIndex &  index)
privateslot
void SUIT_DataBrowser::onExpanded ( const QModelIndex &  index)
privateslot
void SUIT_DataBrowser::onModelUpdated ( )
privateslot
void SUIT_DataBrowser::onStartEditing ( )
privateslot
QString SUIT_DataBrowser::popupClientType ( ) const
virtual
Returns
popup client type

Implements SUIT_PopupClient.

void SUIT_DataBrowser::requestRename ( )
signal
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()
SUIT_DataObject * SUIT_DataBrowser::root ( ) const
Returns
root object

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

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

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::setRoot ( SUIT_DataObject r)
Parameters
rnew root object

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

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

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.

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

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

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

References myShortcutMap.

void SUIT_DataBrowser::updated ( )
signal
bool SUIT_DataBrowser::updateModified ( ) const
Returns
'updateModified' flag value

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

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

Member Data Documentation

bool SUIT_DataBrowser::myAutoSizeColumns
private
bool SUIT_DataBrowser::myAutoSizeFirstColumn
private
bool SUIT_DataBrowser::myResizeOnExpandItem
private
ShortcutMap SUIT_DataBrowser::myShortcutMap
private

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