Public Slots |
Observer * | calculateSelectionParent (QModelIndexList index_list) |
| Function which will calculate the selection parent of a selected object.
|
void | handleContextDataChanged (Observer *observer) |
| Handle context data changes where the context is defined by an Observer reference.
|
void | handleContextDataChanged (const QModelIndex &set_data_index) |
| Handle context data changes where the context is defined by a child QModelIndex.
|
void | handleObserverContextDeleted () |
| This slot will clean up the tree and refresh the view when the top level observer is deleted.
|
void | recordObserverChange (QList< QPointer< QObject > > new_selection=QList< QPointer< QObject > >()) |
| When the observer context changes, this function will take note of the change and when needed, the model will rebuild the internal tree structure using rebuildTreeStructure();.
|
virtual void | setReadOnly (bool read_only) |
| Sets if this model must be read only, thus its actions and property editor will be read only.
|
void | setSelectedCategories (QList< QtilitiesCategory > selected_categories) |
| Function to let the model know which categories is currently selected in the view connected to the model.
|
void | setSelectedObjects (QList< QPointer< QObject > > selected_objects) |
| Function to let the model know which objects are currently selected in the view connected to this model.
|
Signals |
void | expandItemsRequest (QModelIndexList indexes) |
| Signal which requests for a set of items to be expanded in the view.
|
void | selectCategories (QList< QtilitiesCategory > categories) const |
| This signal will be handled by a slot in the ObserverWidget parent of this model and the objects will be selected. The signal is emitted when the tree finished to rebuild itself.
|
void | selectionParentChanged (Observer *new_observer) |
| Signal which is emmited when the current selection parent changed. If the root item is selected, new_observer will be null.
|
void | selectObjects (QList< QPointer< QObject > > objects) const |
| This signal will be handled by a slot in the ObserverWidget parent of this model and the objects will be selected. The signal is emitted when the tree finished to rebuild itself.
|
void | selectObjects (QList< QObject * > objects) const |
| This signal will be handled by a slot in the ObserverWidget parent of this model and the objects will be selected. The signal is emitted when the tree finished to rebuild itself.
|
void | treeModelBuildAboutToStart () const |
| Signal which is emitted just before a tree model rebuild will start.
|
void | treeModelBuildEnded () const |
| Signal which is emitted when a new tree building cycle ends.
|
void | treeModelBuildStarted (int task_id) const |
| Signal which is emitted when a new tree building cycle starts.
|
Public Member Functions |
int | columnPosition (AbstractObserverItemModel::ColumnID column_id) const |
| The model implementation must return the index (starting at 0) for the requested column.
|
int | columnVisiblePosition (AbstractObserverItemModel::ColumnID column_id) const |
| Function which gives the visible column position. Thus it takes into account if columns are hidden.
|
QModelIndex | findCategory (QtilitiesCategory category) const |
| Function to get the model index of a category. If the category does not exist, QModelIndex() is returned.
|
QModelIndexList | findExpandedNodeIndexes (const QStringList &node_names) const |
| Finds the matching QModelIndex indexes for all nodes with display names specified by node_names .
|
QModelIndex | findObject (QObject *obj, int column=-1) const |
| Function to get the model index of an object in the tree. If the object does not exist, QModelIndex() is returned.
|
QModelIndexList | getAllIndexes (ObserverTreeItem *item=0) const |
| Gets all indexes under a specified model index.
|
QModelIndex | getIndex (QObject *obj, int column=-1) const |
| Function to get the model index of an object in the tree. If the object does not exist, QModelIndex() is returned.
|
ObserverTreeItem * | getItem (const QModelIndex &index) const |
| Returns the ObserverTreeItem at a the specified index.
|
QObject * | getObject (const QModelIndex &index) const |
| Abstract function which must be implemented to get the object at the given index.
|
QStack< int > | getParentHierarchy (const QModelIndex &index) const |
| Returns a QStack with the parent hierarchy (in terms of observer IDs) for the object at the given index.
|
QModelIndexList | getPersistentIndexList () const |
| Returns the persistent index list of the model.
|
int | getSubjectID (const QModelIndex &index) const |
| Abstract function which must be implemented to get the subject ID of the object at the given index.
|
Observer * | parentOfIndex (const QModelIndex &index) const |
| Returns the parent observer of the item at the specified index.
|
bool | readOnly () const |
| Gets if this model must be read only, thus its actions and property editor will be read only.
|
void | refresh () |
| Forces this model to refresh its layout.
|
Observer * | selectionParent () const |
| Returns the parent observer of the current selection, it only works if a single item is selected, otherwise returns 0.
|
void | setExpandedItems (QStringList expanded_items) |
| Sets all expanded nodes and categories.
|
virtual bool | setObserverContext (Observer *observer) |
| Implement the virtual function to get references to known filters.
|
ObserverHints * | activeHints () const |
| This function will provide the hints which should be used by this model at any time.
|
QString | columnChildCountBaseClass () const |
| Gets the base class to use for tree count operations in the ColumnChildCount column if shown.
|
int | columnChildCountLimit () const |
| Gets the upper limit to use for tree count operations in the ColumnChildCount column if shown.
|
bool | lazyInitEnabled () const |
| Gets if lazy initialization is enabled.
|
bool | respondToObserverChanges () const |
| Gets if this model responds to changes from the observer context displayed.
|
void | setColumnChildCountBaseClass (const QString &base_class_name) |
| Sets the base class to use for tree count operations in the ColumnChildCount column if shown.
|
void | setColumnChildCountLimit (int limit) |
| Sets the upper limit tree count operations in the ColumnChildCount column if shown.
|
bool | setCustomHints (ObserverHints *custom_hints) |
| This function allows you to copy the custom hints used by this model from a different ObserverHints instance.
|
void | setRespondToObserverChanges (bool respond_to_observer_changes) |
| Sets if this model responds to changes from the observer context displayed.
|
void | toggleLazyInit (bool enabled) |
| Enables/disables lazy initialization.
|
void | toggleUseObserverHints (bool toggle) |
| Function to toggle usage of hints from the active parent observer. If not custom hints will be used.
|
bool | usesObserverHints () const |
| Function to indicate if observer hints are used in this model. If not, the default hints in the model base class is used.
|
Observer * | observerContext () const |
| Gets a pointer to the observer context.
|
The ObserverTreeModel class provides an ready-to-use model that can be used to show the children of an Qtilities::Core::Observer in a QTreeView.
To view the contents of an Qtilities::Core::Observer, use the setObserverContext function. This function will initialize the model and show the names of subjects attached to a specific observer in a QTreeView. ObserverTreeModel has knowledge of the standard subject filters which are included in the Qtilities libraries. Thus it will for example automatically show check boxes etc. if the observer context has an Qtilities::Core::ActivityPolicyFilter installed.
To customize this model you can simply subclass it and reimplement the virtual functions of QAbstractItemModel. This allows you to add columns etc. to your view. The Clipboard Example shows how to do this.
- See also:
- ObserverTableModel