Object browser customization.
#include <SUIT_DataBrowser.h>

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_DataObject * | root () 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... | |
| QAbstractItemModel * | model () 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) |
| QtxSearchTool * | searchTool () 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... | |
| QtxTreeView * | treeView () 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 |
|
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 | ( | ) |
| bool SUIT_DataBrowser::autoUpdate | ( | ) | const |
References SUIT_ProxyModel::autoUpdate(), and OB_Browser::model().
|
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 |
|
protectedvirtual |
| e | context menu event |
Reimplemented from OB_Browser.
References SUIT_PopupClient::contextMenuRequest().
|
virtual |
| menu | popup menu |
Reimplemented from SUIT_PopupClient.
References OB_Browser::createPopupMenu().
|
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::ensureVisible | ( | SUIT_DataObject * | obj | ) |
| obj | data object |
| void SUIT_DataBrowser::ensureVisible | ( | const DataObjectList & | lst | ) |
| lst | data object list |
References SUIT_AbstractModel::index(), OB_Browser::model(), and OB_Browser::treeView().
| 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(), obj, SUIT_ProxyModel::object(), and OB_Browser::selectedIndexes().
|
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.
|
privateslot |
Emits signal clicked( SUIT_DataObject* );
References clicked(), SUIT_ProxyModel::emitClicked(), OB_Browser::model(), obj, and SUIT_ProxyModel::object().
|
privateslot |
Emits signal doubleClicked( SUIT_DataObject* );
References doubleClicked(), OB_Browser::model(), obj, and SUIT_ProxyModel::object().
|
privateslot |
|
privateslot |
References OB_Browser::setModified().
|
privateslot |
|
virtual |
Implements SUIT_PopupClient.
|
signal |
|
signal |
By default, [F5] key is assigned for the update operation. The key accelerator can be changed with the setShortcutKey() method.
| SUIT_DataObject * SUIT_DataBrowser::root | ( | ) | const |
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.
| on | 'auto-size columns' flag value |
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.
| on | 'auto-size first column' flag value |
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.
| on | 'auto-update tree' flag value |
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.
| on | 'resize on expand item' flag value |
References myResizeOnExpandItem.
| void SUIT_DataBrowser::setRoot | ( | SUIT_DataObject * | r | ) |
| r | new root object |
References OB_Browser::model(), and SUIT_ProxyModel::setRoot().
| 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(), obj, and OB_Browser::select().
| id | id of the shortcut |
| key | new key accelerator |
References myShortcutMap.
| void SUIT_DataBrowser::setUpdateModified | ( | const bool | on | ) |
| on | 'updateModified' flag value |
References OB_Browser::model(), and SUIT_ProxyModel::setUpdateModified().
| int SUIT_DataBrowser::shortcutKey | ( | const int | id | ) | const |
References myShortcutMap.
|
signal |
| bool SUIT_DataBrowser::updateModified | ( | ) | const |
References OB_Browser::model(), and SUIT_ProxyModel::updateModified().
| 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(), updated(), and SUIT_ProxyModel::updateTree().
|
private |
|
private |
|
private |
|
private |