Object browser customization.
#include <SUIT_DataBrowser.h>

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_DataObject * | root () 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. | |
| QAbstractItemModel * | model () 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) |
| QtxSearchTool * | searchTool () 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. | |
| QtxTreeView * | treeView () 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 |
typedef QMap<int, QShortcut*> SUIT_DataBrowser.ShortcutMap [private] |
| SUIT_DataBrowser::SUIT_DataBrowser | ( | QWidget * | parent = 0 | ) |
| parent | parent widget |
References init().
| SUIT_DataBrowser::SUIT_DataBrowser | ( | SUIT_DataObject * | root, |
| QWidget * | parent = 0 |
||
| ) |
| root | root data object |
| parent | parent widget |
References init().
| SUIT_DataBrowser::~SUIT_DataBrowser | ( | ) |
| QString SUIT_DataBrowser::popupClientType | ( | ) | const [virtual] |
Implements SUIT_PopupClient.
| SUIT_DataObject * SUIT_DataBrowser::root | ( | ) | const |
References OB_Browser.model(), and SUIT_ProxyModel.root().
| void SUIT_DataBrowser::setRoot | ( | SUIT_DataObject * | r | ) |
| r | new root object |
References OB_Browser.model(), and SUIT_ProxyModel.setRoot().
| bool SUIT_DataBrowser::autoUpdate | ( | ) | const |
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.
| on | 'auto-update tree' flag value |
References OB_Browser.model(), and SUIT_ProxyModel.setAutoUpdate().
| bool SUIT_DataBrowser::updateModified | ( | ) | const |
References OB_Browser.model(), and SUIT_ProxyModel.updateModified().
| void SUIT_DataBrowser::setUpdateModified | ( | const bool | on | ) |
| on | 'updateModified' flag value |
References OB_Browser.model(), and SUIT_ProxyModel.setUpdateModified().
| void SUIT_DataBrowser::updateTree | ( | SUIT_DataObject * | obj = 0, |
| const bool | autoOpen = true |
||
| ) |
| obj | starting object for updating |
| autoOpen | if 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 |
References myShortcutMap.
| void SUIT_DataBrowser::setShortcutKey | ( | const int | id, |
| const int | key | ||
| ) |
| id | id of the shortcut |
| key | new key accelerator |
References myShortcutMap.
| DataObjectList SUIT_DataBrowser::getSelected | ( | ) | const |
| void SUIT_DataBrowser::getSelected | ( | DataObjectList & | lst | ) | const |
| lst | list 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 |
||
| ) |
| obj | data object to set selected |
| append | if 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 |
||
| ) |
| lst | list of the data object to set selected |
| append | if 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] |
| menu | popup 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.
| on | 'auto-size first column' flag value |
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.
| on | 'auto-size columns' flag value |
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.
| on | 'resize on expand item' flag value |
References myResizeOnExpandItem.
| void SUIT_DataBrowser::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
| e | context menu event |
Reimplemented from OB_Browser.
References SUIT_PopupClient.contextMenuRequest().
| void SUIT_DataBrowser::init | ( | SUIT_DataObject * | root | ) | [private] |
| root | root data object |
References clicked(), doubleClicked(), OB_Browser.model(), myAutoSizeColumns, myAutoSizeFirstColumn, myResizeOnExpandItem, myShortcutMap, onClicked(), onDblClicked(), onExpanded(), onModelUpdated(), onStartEditing(), RenameShortcut, requestRename(), requestUpdate(), OB_Browser.setItemDelegate(), OB_Browser.setModel(), OB_Browser.treeView(), and UpdateShortcut.
| 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.
| 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.
| o | data 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.
| o | data object which is double-clicked |
| void SUIT_DataBrowser::onModelUpdated | ( | ) | [private, slot] |
References OB_Browser.setModified().
| void SUIT_DataBrowser::onClicked | ( | const QModelIndex & | index | ) | [private, slot] |
Emits signal clicked( SUIT_DataObject* );
References clicked(), SUIT_ProxyModel.emitClicked(), OB_Browser.model(), PyInterp.obj, and SUIT_ProxyModel.object().
| void SUIT_DataBrowser::onDblClicked | ( | const QModelIndex & | index | ) | [private, slot] |
Emits signal doubleClicked( SUIT_DataObject* );
References doubleClicked(), OB_Browser.model(), PyInterp.obj, and SUIT_ProxyModel.object().
| void SUIT_DataBrowser::onExpanded | ( | const QModelIndex & | index | ) | [private, slot] |
| void SUIT_DataBrowser::onStartEditing | ( | ) | [private, slot] |
| QAbstractItemModel * OB_Browser::model | ( | ) | const [inherited] |
| void OB_Browser::setModel | ( | QAbstractItemModel * | model | ) | [inherited] |
| model | data model |
References OB_Browser.myView, QtxTreeView.setModel(), and OB_Browser.setModified().
| QAbstractItemDelegate * OB_Browser::itemDelegate | ( | ) | const [inherited] |
| void OB_Browser::setItemDelegate | ( | QAbstractItemDelegate * | d | ) | [inherited] |
| bool OB_Browser::rootIsDecorated | ( | ) | const [inherited] |
true if top-level items are decorated References OB_Browser.myView.
| void OB_Browser::setRootIsDecorated | ( | const bool | decor | ) | [inherited] |
| decor | if true, top-level items are decorated |
References OB_Browser.myView, and OB_Browser.rootIsDecorated().
| bool OB_Browser::sortMenuEnabled | ( | ) | const [inherited] |
References OB_Browser.myView, and QtxTreeView.sortMenuEnabled().
| void OB_Browser::setSortMenuEnabled | ( | const bool | enabled | ) | [inherited] |
References OB_Browser.myView, QtxTreeView.setSortMenuEnabled(), and OB_Browser.sortMenuEnabled().
| QtxSearchTool * OB_Browser::searchTool | ( | ) | const [inherited] |
References OB_Browser.mySearchTool.
| bool OB_Browser::isSearchToolEnabled | ( | ) | const [inherited] |
true if search tool is enabled References OB_Browser.mySearchTool.
| void OB_Browser::setSearchToolEnabled | ( | const bool | enable | ) | [inherited] |
| enable | pass true to enable search tool |
References OB_Browser.mySearchTool.
| int OB_Browser::autoOpenLevel | ( | ) | const [inherited] |
References OB_Browser.myAutoOpenLevel.
| void OB_Browser::setAutoOpenLevel | ( | const int | levels | ) | [inherited] |
| levels | number of levels to be auto-opened on tree updating |
References OB_Browser.myAutoOpenLevel.
| void OB_Browser::openLevels | ( | const int | levels = -1 | ) | [inherited] |
If levels value is negative, then autoOpenLevel() value is used instead.
| levels | number of levels to be expanded |
References OB_Browser.autoOpenLevel(), QtxTreeView.expandLevels(), and OB_Browser.myView.
| int OB_Browser::numberOfSelected | ( | ) | const [inherited] |
Sets new value of state "are tooltips shown"
| theDisplay | - new value |
References OB_Browser.myView.
| QModelIndexList OB_Browser::selectedIndexes | ( | ) | const [inherited] |
References OB_Browser.myView.
| const QItemSelection OB_Browser::selection | ( | ) | const [inherited] |
References OB_Browser.myView.
| void OB_Browser::select | ( | const QModelIndex & | index, |
| const bool | on, | ||
| const bool | keepSelection = true |
||
| ) | [virtual, inherited] |
| index | model index to be selected/deselected |
| on | if true, the index will be selected, otherwise - deselected |
| keepSelection | if 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] |
| indexes | model indices to be selected/deselected |
| on | if true, the indices will be selected, otherwise - deselected |
| keepSelection | if 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] |
| index | model index |
true if model index is expanded References OB_Browser.model(), and OB_Browser.myView.
| void OB_Browser::setOpen | ( | const QModelIndex & | index, |
| const bool | open = true |
||
| ) | [virtual, inherited] |
| index | model index |
| open | if true, the index will be expanded, otherwse - collapsed |
References OB_Browser.myView.
| void OB_Browser::adjustWidth | ( | ) | [inherited] |
References OB_Browser.myView, and QtxTreeView.resizeColumnToEncloseContents().
| void OB_Browser::adjustFirstColumnWidth | ( | ) | [inherited] |
References OB_Browser.myView, and QtxTreeView.resizeColumnToEncloseContents().
| void OB_Browser::adjustColumnsWidth | ( | ) | [inherited] |
References OB_Browser.myView, and QtxTreeView.resizeColumnToEncloseContents().
| unsigned long OB_Browser::getModifiedTime | ( | ) | const [inherited] |
References OB_Browser.myModifiedTime.
| void OB_Browser::setModified | ( | ) | [inherited] |
References OB_Browser.myModifiedTime.
| QtxTreeView * OB_Browser::treeView | ( | ) | const [inherited] |
| pos | - position |
Changes filter of list view
| f | - new filter |
Sets global width mode
| mode | - new width mode |
Updates tree
| obj | - start object |
| autoOpen | - to open automatically branches of autoOpenLevel() |
Replaces part of tree starting at object 'src' by tree starting at object 'trg'
Adjusts width by item
| 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
| 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
| 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
References OB_Browser.myView.
| void OB_Browser::selectionChanged | ( | ) | [signal, inherited] |
Removes SUIT object
| obj | - SUIT object to be removed |
| autoUpd | - auto tree updating |
Opens branches from 1 to autoOpenLevel()
Opens branch
| 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
| items | - dragged items |
| item | - destination (item on that they were dropped) |
| action | - QDropEvent.Action |
Updates texts of items
| item | - item to be checked |
Updates texts of item
| item | - item to be updated |
| menu | popup 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().
ShortcutMap SUIT_DataBrowser.myShortcutMap [private] |
bool SUIT_DataBrowser.myAutoSizeFirstColumn [private] |
bool SUIT_DataBrowser.myAutoSizeColumns [private] |
bool SUIT_DataBrowser.myResizeOnExpandItem [private] |