All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions
Qtilities::CoreGui::ObserverWidget Class Reference

The ObserverWidget class provides a ready-to-use widget to display information about a specific observer context. More...

#include <ObserverWidget.h>

Inheritance diagram for Qtilities::CoreGui::ObserverWidget:
Inheritance graph
[legend]

List of all members.

Public Slots

void clearSelection ()
 Clears the current selection in the view.
void expandNodes (const QStringList &node_names)
 Expand all nodes for which their display names matches the node_names parameters.
void expandNodes (QModelIndexList indexes)
 Expand all nodes specified by the indexes in indexes.
virtual void handle_actionNewItem_triggered ()
 This function is triggered by the Qtilities::Core::ObserverHints::ActionNewItem action.
virtual void handle_actionPaste_triggered ()
 Function which is connected to the Qtilities::CoreGui::Actions::qti_action_EDIT_PASTE action if it exists.
void handleLayoutChangeCompleted ()
 Handle post layout changed actions in table view mode.
void handleSearchItemTypesChanged ()
 Handle changes to the type of items which must be filtered.
void handleSearchOptionsChanged ()
 Handles search options changes in the SearchBoxWidget if present.
void handleSearchStringChanged (const QString &filter_string)
 Handles search string changes in the SearchBoxWidget if present.
void handleSelectionModelChange ()
 Handles the selection model change.
void handleSettingsUpdateRequest (const QString &request_id)
 Monitors the settings update request signal on the QtilitiesCoreGui instance.
virtual void refresh ()
 Refreshes the current item view.
void refreshActions ()
 Refreshes the state of all actions.
void resizeColumns ()
 Resizes columns to their match their contents.
void resizeTableViewRows (int height=-1)
 Slot which resizes the rows in table view mode.
ObserverTreeItem::TreeItemTypeFlags searchBoxCheckedItemFilters () const
 Gets the active item type filters in the menu on the search box widget used in this ObserverWidget.
void selectCategories (QList< QtilitiesCategory > categories)
 Selects the specified categories in the active item view.
void selectCategory (QtilitiesCategory category)
 Selects the specified object in the active item view.
virtual void selectionCopy ()
 Function to copy the current selection to the application clipboard.
virtual void selectionCut ()
 Function to cut the current selection to the application clipboard.
virtual void selectionDelete ()
 Deletes the current selected items.
virtual void selectionDeleteAll ()
 Deletes all subjects under the current selection parent or in the selected context.
virtual void selectionDetach ()
 Detaches the current selected objects in the item view from the current selection parent.
virtual void selectionDetachAll ()
 Detaches all subjects from the current selection parent.
virtual void selectionPushDown ()
 In TableView mode this function can be used to push down into (set the observer context of the widget) to the current selected observer.
virtual void selectionPushDownNew ()
 In TableView mode this function can be used to push down into (set the observer context of the widget) to the current selected observer in a new ObserverWidget.
virtual void selectionPushUp ()
 In TableView mode this function can be used to push up to (set the observer context of the widget) to the current selection parent.
virtual void selectionPushUpNew ()
 In TableView mode this function can be used to push up to (set the observer context of the widget) to the current selection parent in a new ObserverWidget.
void selectObject (QObject *object)
 Selects the specified object in the active item view.
void selectObjects (QList< QObject * > objects)
 Selects the specified objects in the active item view.
void selectObjects (QList< QPointer< QObject > > objects)
 Selects the specified objects in a smart pointer list in the active item view.
void setPreferredDynamicPropertyEditorDockArea (Qt::DockWidgetArea property_editor_dock_area)
 Sets the desired area of the dynamic property editor (if it is used by the observer context).
void setPreferredDynamicPropertyEditorType (ObjectDynamicPropertyBrowser::BrowserType property_editor_type)
 Sets the desired type of the dynamic property editor (if it is used by the observer context).
void setPreferredPropertyEditorDockArea (Qt::DockWidgetArea property_editor_dock_area)
 Sets the desired area of the property editor (if it is used by the observer context).
void setPreferredPropertyEditorType (ObjectPropertyBrowser::BrowserType property_editor_type)
 Sets the desired type of the property editor (if it is used by the observer context).
void setPreferredPropertyFilter (QStringList filter_list, bool inversed_filter=false)
 Sets the desired property browser filter list to be used when constructing a property browser in this widget.
void setSearchBoxCheckedItemFilters (ObserverTreeItem::TreeItemTypeFlags item_filter_flags)
 Sets the active item type filters in the menu on the search box widget used in this ObserverWidget.
virtual void toggleDisplayMode ()
 Toggles the display mode of the ObserverWidget.
void toggleSearchBox ()
 Toggles the visibility of the SearchBoxWidget at the bottom of the ObserverWidget.
virtual void viewCollapseAll ()
 Collapse all items in the tree view to a depth of 1 in TreeView mode.
virtual void viewExpandAll ()
 Expand all items in the tree view in TreeView mode.
virtual void writeSettings ()
 Slot connected to QCoreApplication::aboutToQuit() signal.

Signals

void addActionNewItem_triggered (QObject *object, Observer *parent_observer=0)
 Signal which is emitted when the add new item action is triggered.
void displayModeChanged (Qtilities::DisplayMode display_mode)
 Signal which is emitted when the display mode of this widget is toggled.
void doubleClickRequest (QObject *object, Observer *parent_observer=0)
 Signal which is emitted when the user double clicks on an item in the observer widget.
void expandedNodesChanged (const QStringList &node_names)
 Signal which is emitted when the expanded nodes changes.
void newObserverWidgetCreated (ObserverWidget *new_widget)
 Signal which is emitted when the user pushes up/down in a new observer widget. The new widget is passed as a paramater.
void observerContextChanged (Observer *new_context)
 Signal which is emitted when the observer context of this widget changes.
void readOnlyStateChanged (bool read_only)
 Signal which is emitted when this widget's read only state changes.
void selectedObjectsChanged (QList< QObject * > selected_objects, Observer *selection_parent=0)
 Signal which is emitted when object selection changes.
void treeModelBuildEnded () const
 Signal which is emitted when a new tree building cycle ends (Only when in TreeView mode).
void treeModelBuildStarted (int task_id) const
 Signal which is emitted when a new tree building cycle starts (Only when in TreeView mode).

Public Member Functions

IActionProvideractionProvider ()
 Returns the action handler interface for this observer widget.
ObserverHintsactiveHints () const
 This function will provide the hints which should be used by this widget at any time.
bool appendSelectedContexts () const
 Indicates if this observer widget appends contexts of selected objects implementing IContext.
bool confirmDeletes () const
 Function to get the interaction with the user when deleting subjects.
QString contextHelpId () const
 Returns a help ID for this context.
QString contextString () const
 In the case of an ObserverWidget, the contextString() is the same as the globalMetaType().
int defaultRowHeight () const
 Function to get the default height used for the table view when this widget is used in TableView mode.
void disableAutoColumnResizing ()
 Disables automatic column resizing in the displayed table or tree view, depending on the displayMode().
void disableProxyModels () const
 Disables usage of proxy filter models.
DisplayMode displayMode () const
 Gets the display mode of the widget.
Qt::MouseButton dragDropCopyButton () const
 Gets the mouse button to use for drag and drop copy operations.
Qt::MouseButton dragDropMoveButton () const
 Gets the mouse button to use for drag and drop move operations.
ObjectDynamicPropertyBrowserdynamicPropertyBrowser ()
 Returns the dynamic property editor used inside the observer widget. This can be 0 depending on the display flags used. Always call this function after initialize().
QDockWidget * dynamicPropertyBrowserDock ()
 Returns the dock widget containing the dynamic property browser.
void enableAutoColumnResizing ()
 Enables automatic column resizing in the displayed table or tree view, depending on the displayMode().
bool eventFilter (QObject *object, QEvent *event)
 Event filter which has responsibilities such as drag and drop operations etc.
QStringList findExpandedItems () const
 Finds all expanded items in the current view.
QString globalMetaType () const
 Gets the global meta type used for this observer widget.
virtual void initialize (bool hints_only=false)
 Initializes the observer widget. Make sure to set the item model as well as the flags you would like to use before calling initialize.
QStringList lastExpandedItemsResults () const
 Returns the last set of calculated expanded items from the last findExpandedItems() call without calculating them again.
bool lazyInitEnabled () const
 Gets if lazy initialization is enabled.
QStack< int > navigationStack () const
 Gets the current navigation stack of this widget.
QObject * objectBase ()
 Returns the QObject* base of the interface.
const QObject * objectBase () const
 Returns a const QObject* base of the interface.
 ObserverWidget (DisplayMode display_mode=TreeView, QWidget *parent=0, Qt::WindowFlags f=0)
 Default constructor.
 ObserverWidget (Observer *observer_context, DisplayMode display_mode=TreeView, QWidget *parent=0, Qt::WindowFlags f=0)
 A constructor which takes the observer context to be displayed as the first parameter.
ObjectPropertyBrowserpropertyBrowser ()
 Returns the property editor used inside the observer widget. This can be 0 depending on the display flags used. Always call this function after initialize().
QDockWidget * propertyBrowserDock ()
 Returns the dock widget containing the property browser.
bool readOnly () const
 Gets if this widget must be read only, thus its actions and property editor will be read only.
virtual void readSettings ()
 Restores the widget to a previous state.
void refreshActionToolBar (bool force_full_refresh=false)
 Refreshes the action toolbar with the current state of the actions.
SearchBoxWidgetsearchBoxWidget ()
 Returns the SearchBoxWidget contained inside the observer widget.
QModelIndexList selectedIndexes () const
 Provides a list of QModelIndexes which are currently selected. Use this call instead of the item model selection's selectedIndexes() call since this function will map the indexes from the proxy model's indexes to the real model's indexes.
QList< QObject * > selectedObjects () const
 Provides a list of QObject pointers to all the selected objects.
bool selectedObjectsContextMatch () const
 Checks if all current selectedObjects() are in the same context.
bool selectedObjectsHintsMatch () const
 Checks if all current selectedObjects() share the same ObserverHints.
ObserverselectionParent () const
 Provides a pointer to the current selection's parent. If no objects are selected, 0 is returned.
void setAppendSelectedContexts (bool enable)
 Enables/disables appending of selected contexts when selected objects change.
void setConfirmDeletes (bool confirm_deletes)
 Function to set the interaction with the user when deleting subjects.
bool setCustomHints (ObserverHints *custom_hints)
 This function allows you to copy the custom hints used by this ObserverWidget from a different ObserverHints instance.
bool setCustomTableModel (ObserverTableModel *table_model)
 Function which sets a custom table model to be used in this widget when its in TableView mode.
bool setCustomTableProxyModel (QAbstractProxyModel *proxy_model)
 Function which sets a custom table proxy model to be used in this widget when its in TableView mode.
bool setCustomTreeModel (ObserverTreeModel *tree_model)
 Function which sets a custom tree model to be used in this widget when its in TreeView mode.
bool setCustomTreeProxyModel (QAbstractProxyModel *proxy_model)
 Function which sets a custom tree proxy model to be used in this widget when its in TreeView mode.
void setDefaultRowHeight (int height)
 Function to set the default height used for the table view when this widget is used in TableView mode.
void setDisplayMode (DisplayMode display_mode)
 Sets the display mode of the widget.
void setDragDropCopyButton (Qt::MouseButton mouse_button)
 Sets the mouse button to use for drag and drop copy operations.
void setDragDropMoveButton (Qt::MouseButton mouse_button)
 Sets the mouse button to use for drag and drop move operations.
bool setGlobalMetaType (const QString &meta_type)
 Sets the global meta type used for this observer widget.
void setNavigationStack (QStack< int > navigation_stack)
 Allows you to set the navigation stack of this widget.
bool setObserverContext (Observer *observer)
 Implementation of virtual function ObserverAwareBase::setObserverContext().
virtual void setReadOnly (bool read_only)
 Sets if this widget must be read only, thus its actions and property editor will be read only.
void setSharedGlobalMetaType (const QString &shared_meta_type)
 Function which allows this observer widget to share global object activity with other observer widgets.
void setTreeExpandCollapseVisible (bool is_visible)
 Sets if the "Expand All"/"Collapse All" actions should be visible when in TreeView mode.
QString sharedGlobalMetaType () const
 Function to get the shared global activity meta type of this observer widget.
QTableView * tableView ()
 Function providing access to the contained table view.
void toggleLazyInit (bool enabled)
 Enables/disables lazy initialization.
void toggleUseGlobalActiveObjects (bool toggle)
 Function to toggle if this observer widget updates global active objects under its globalMetaType() meta type.
void toggleUseObserverHints (bool toggle)
 Function to toggle usage of hints from the active parent observer. If not default hints will be used.
int topLevelObserverID ()
 Returns the observer ID of the top level observer in the widget. If the top level observer is not defined, -1 is returned.
bool treeExpandCollapseVisible () const
 Gets if the "Expand All"/"Collapse All" actions should be visible when in TreeView mode.
QTreeView * treeView ()
 Function providing access to the contained tree view.
void updateGlobalActiveSubjects ()
 Sets the global object subject type used by this observer widget.
bool useGlobalActiveObjects () const
 Indicates if this observer widget updates global active objects.
bool usesObserverHints () const
 Indicates if this widget uses its own custom hints or that of the active observer.
QAbstractItemView * view ()
 Function providing access to the QAbstractItemView view base class.
virtual ~ObserverWidget ()
 Default destructor.
- Public Member Functions inherited from Qtilities::Core::ObserverAwareBase
ObserverobserverContext () const
 Gets a pointer to the observer context.

Protected Member Functions

void constructActions ()
 Constructs actions inside the observer widget.
void constructDynamicPropertyBrowser ()
 Constructs the dynamic property browser and show it. If it already exists, this function does nothing.
void constructPropertyBrowser ()
 Constructs the property browser and show it. If it already exists, this function does nothing.
void deleteActionToolBars ()
 Deletes all the current action toolbars.
void refreshDynamicPropertyBrowser ()
 Refreshes the dynamic property browser, thus hide or show it depending on the active display flags.
void refreshPropertyBrowser ()
 Refreshes the property browser, thus hide or show it depending on the active display flags.

Detailed Description

The ObserverWidget class provides a ready-to-use widget to display information about a specific observer context.

The ObserverWidget class provides a ready-to-use widget to display information about a specific observer context, reducing the workload when you need to display data related to a specific observer context. The goal of the observer widget is to maximize the possible number of usage scenarios by being as customizable as possible.

Below is an example of a basic observer widget in tree mode.

observer_widget_doc_tree_view_simple.jpg
Observer Widget (Tree View Mode)

The Observer Widgets article provides a comprehensive overview of the different ways that the observer widget can be used.


Constructor & Destructor Documentation

Qtilities::CoreGui::ObserverWidget::ObserverWidget ( DisplayMode  display_mode = TreeView,
QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)

Default constructor.

Parameters:
display_modeThe display mode that should be used.
parentThe parent widget.
fThe Qt::WindowFlags which must be used for the widget.
Qtilities::CoreGui::ObserverWidget::ObserverWidget ( Observer observer_context,
DisplayMode  display_mode = TreeView,
QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)

A constructor which takes the observer context to be displayed as the first parameter.

This constructor can be used if no functions need to be called on the observer widget object before initializing it. The result is less code:

// The long way:
ObserverWidget* categorized_widget = new ObserverWidget();
categorized_widget->setObserverContext(contextPtr);
categorized_widget->initialize();
categorized_widget->show();
// The short way:
ObserverWidget* categorized_widget = new ObserverWidget(contextPtr);
categorized_widget->show();
Parameters:
observer_contextThe observer context to be displayed. If invalid, the constructor will not call setObserverContext() and initialize().
display_modeThe display mode that should be used.
parentThe parent widget.
fThe Qt::WindowFlags which must be used for the widget.

Member Function Documentation

Qtilities::CoreGui::Interfaces::IActionProvider * Qtilities::CoreGui::ObserverWidget::actionProvider ( )

Returns the action handler interface for this observer widget.

All constructed actions for the current observer context will be available through this function.

Actions are grouped into the following categories:

  • Items : Actions related to actions that can be performed on selected items.
  • View : Actions related to actions that can be performed on the item view (such as switching it etc.)
  • Hierarchy : Actions related observer tree hierarhcies.

It is possible to add actions to these categories.

Qtilities::Core::ObserverHints * Qtilities::CoreGui::ObserverWidget::activeHints ( ) const

This function will provide the hints which should be used by this widget at any time.

See also:
toggleUseObserverHints(), setCustomHints()
void Qtilities::CoreGui::ObserverWidget::addActionNewItem_triggered ( QObject *  object,
Observer parent_observer = 0 
)
signal

Signal which is emitted when the add new item action is triggered.

The parameters used during this signal emission is defferent depending on the display mode and the selected objects. The following are the possible scenarios:

1) Table View Mode: no object selected:

Parameters:
objectThe context displayed in the table.
parent_observerThe last context in the navigation stack, if no such context exists 0 is returned.

2) Table View Mode: 1 object selected:

If an observer is selected with the ObserverHints::SelectionUseSelectedContext hint the following parameters are used:

Parameters:
object0.
parent_observerThe selected observer.

If an observer is selected with no hints or the ObserverHints::SelectionUseParentContext hint, or if an normal object is selected:

Parameters:
objectThe selected object.
parent_observerThe context currently displayed in the table view.

3) Table View Mode: multiple objects selected:

Parameters:
objectNull (0).
parent_observerThe context currently displayed in the table view.

4) Tree View Mode: no objects selected:

Parameters:
objectNull (0).
parent_observerThe last context in the navigation stack, if no such context exists 0 is returned.

5) Tree View Mode: 1 object selected:

If an observer is selected with the ObserverHints::SelectionUseSelectedContext hint the following parameters are used:

Parameters:
object0.
parent_observerThe selected observer.

If an observer is selected with no hints or the ObserverHints::SelectionUseParentContext hint, or if an normal object is selected:

Parameters:
objectThe selected object.
parent_observerThe parent context of the selected object. If it does not have a parent, 0.

6) Tree View Mode: multiple objects selected:

Parameters:
objectNull (0).
parent_observerThe parent context of the selected object. If it does not have a parent, 0.
Note:
In Tree View Mode, categories are handled as normal QObjects with the category name accessible through the objectName() function.
bool Qtilities::CoreGui::ObserverWidget::appendSelectedContexts ( ) const

Indicates if this observer widget appends contexts of selected objects implementing IContext.

False by default.

See also:
setAppendSelectedContexts()
void Qtilities::CoreGui::ObserverWidget::clearSelection ( )
slot

Clears the current selection in the view.

See also:
selectedObjectsChanged(), selectObjects(), selectObject()
bool Qtilities::CoreGui::ObserverWidget::confirmDeletes ( ) const

Function to get the interaction with the user when deleting subjects.

The default is true.

See also:
setConfirmDeletes(), selectionDelete(), selectionDeleteAll()
void Qtilities::CoreGui::ObserverWidget::constructDynamicPropertyBrowser ( )
protected

Constructs the dynamic property browser and show it. If it already exists, this function does nothing.

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::constructPropertyBrowser ( )
protected

Constructs the property browser and show it. If it already exists, this function does nothing.

This function was added in Qtilities v1.1.

int Qtilities::CoreGui::ObserverWidget::defaultRowHeight ( ) const

Function to get the default height used for the table view when this widget is used in TableView mode.

See also:
setDefaultRowHeight()
void Qtilities::CoreGui::ObserverWidget::disableAutoColumnResizing ( )

Disables automatic column resizing in the displayed table or tree view, depending on the displayMode().

See also:
enableAutoColumnResizing()
void Qtilities::CoreGui::ObserverWidget::disableProxyModels ( ) const

Disables usage of proxy filter models.

This function must be called before initializing the widget for the first time, and it cannot be enabled once it was disabled.

Note:
When disabling proxy models, the search box is not available. See toggleSearchBox().
Qtilities::DisplayMode Qtilities::CoreGui::ObserverWidget::displayMode ( ) const

Gets the display mode of the widget.

See also:
setDisplayMode(), toggleDisplayMode()
void Qtilities::CoreGui::ObserverWidget::doubleClickRequest ( QObject *  object,
Observer parent_observer = 0 
)
signal

Signal which is emitted when the user double clicks on an item in the observer widget.

The parameters used during this signal emission is defferent depending on the display mode and the selected objects. The following are the possible scenarios:

1) Table View Mode: 1 object selected:

If an observer is double clicked with the ObserverHints::SelectionUseSelectedContext hint the following parameters are used:

Parameters:
object0.
parent_observerThe selected observer.

If an observer is double clicked with no hints or the ObserverHints::SelectionUseParentContext hint, or if an normal object is selected:

Parameters:
objectThe selected object.
parent_observerThe context currently displayed in the table view.

2) Tree View Mode: 1 object selected:

If an observer is double clicked with the ObserverHints::SelectionUseSelectedContext hint the following parameters are used:

Parameters:
object0.
parent_observerThe selected observer.

If an observer is double clicked with no hints or the ObserverHints::SelectionUseParentContext hint, or if an normal object is selected:

Parameters:
objectThe selected object.
parent_observerThe parent context of the selected object. If it does not have a parent, 0.
Note:
In Tree View Mode, categories are handled as normal QObjects with the category name accessible through the objectName() function.
Qt::MouseButton Qtilities::CoreGui::ObserverWidget::dragDropCopyButton ( ) const

Gets the mouse button to use for drag and drop copy operations.

By default Qt::RightButton.

See also:
setDragDropCopyButton()
Qt::MouseButton Qtilities::CoreGui::ObserverWidget::dragDropMoveButton ( ) const

Gets the mouse button to use for drag and drop move operations.

By default Qt::RightButton.

See also:
setDragDropMoveButton()
Qtilities::CoreGui::ObjectDynamicPropertyBrowser * Qtilities::CoreGui::ObserverWidget::dynamicPropertyBrowser ( )

Returns the dynamic property editor used inside the observer widget. This can be 0 depending on the display flags used. Always call this function after initialize().

See also:
dynamicPropertyBrowserDock(), propertyBrowserDock(), propertyBrowser()

This function was added in Qtilities v1.1.

QDockWidget * Qtilities::CoreGui::ObserverWidget::dynamicPropertyBrowserDock ( )

Returns the dock widget containing the dynamic property browser.

See also:
dynamicPropertyBrowser(), propertyBrowserDock(), propertyBrowser()

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::enableAutoColumnResizing ( )

Enables automatic column resizing in the displayed table or tree view, depending on the displayMode().

True by default which will cause the view's columns to be resized to their contents and the name column to be streched. If you would like to do this manually, for example if you want to stretch a custom column, you should disable this.

See also:
disableAutoColumnResizing()
void Qtilities::CoreGui::ObserverWidget::expandedNodesChanged ( const QStringList &  node_names)
signal

Signal which is emitted when the expanded nodes changes.

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::expandNodes ( const QStringList &  node_names)
slot

Expand all nodes for which their display names matches the node_names parameters.

If any name in node_names does not exist in the tree it is ignored.

Parameters:
node_namesThe node names to expand. When empty, viewExpandAll() will be called.
See also:
findExpandedItems();

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::expandNodes ( QModelIndexList  indexes)
slot

Expand all nodes specified by the indexes in indexes.

If any name in node_names does not exist in the tree it is ignored.

Parameters:
indexesThe indexes to expand. When empty, viewExpandAll() will be called.
See also:
findExpandedItems();
QStringList Qtilities::CoreGui::ObserverWidget::findExpandedItems ( ) const

Finds all expanded items in the current view.

It should not be neccesarry to use this function directly, rather use lastExpandedItemsResults() since the internal list of expanded items is automatically updated whenever the expansion state of any item in the view changes.

Use this function only if you want to force recalculation of the expanded items.

Note:
Only usefull when displayMode() is Qtilities::TreeView.
See also:
expandNodes(), lastExpandedItemsResults()

This function was added in Qtilities v1.1.

QString Qtilities::CoreGui::ObserverWidget::globalMetaType ( ) const

Gets the global meta type used for this observer widget.

The global meta type is a string which defines this observer widget. The string must be a string which can be registered in the context manager. Thus, such a string must not yet exist as a context in the context manager.

The global meta type is used for the following:

Returns:
The meta type used for this observer widget.
See also:
setGlobalMetaType(), updateGlobalActiveSubjects(), setSharedGlobalMetaType(), sharedGlobalMetaType()
void Qtilities::CoreGui::ObserverWidget::handle_actionPaste_triggered ( )
virtualslot

Function which is connected to the Qtilities::CoreGui::Actions::qti_action_EDIT_PASTE action if it exists.

When initializing the Qtilities clipboard manager the paste action will be created automatically.

void Qtilities::CoreGui::ObserverWidget::handleSelectionModelChange ( )
slot

Handles the selection model change.

This function is called whenever the selection in the item view changes. The function will handle the selection change and then emit selectedObjectChanged().

In TreeView mode, the function will call the Qtilities::CoreGui::ObserverTreeModel::calculateSelectionParent() function to update the selection parent in the tree. Once the selection parent is updated, the setTreeSelectionParent() function will be called which will call initialize(true) on this widget in order to initialize the widget for the new selection parent.

void Qtilities::CoreGui::ObserverWidget::initialize ( bool  hints_only = false)
virtual

Initializes the observer widget. Make sure to set the item model as well as the flags you would like to use before calling initialize.

See also:
toggleLazyInit(), lazyInitEnabled()
QStringList Qtilities::CoreGui::ObserverWidget::lastExpandedItemsResults ( ) const

Returns the last set of calculated expanded items from the last findExpandedItems() call without calculating them again.

When findExpandedItems() is called it stores the results internally. Thus function accesses those results without recalculating them.

See also:
findExpandedItems(), expandNodes()

This function was added in Qtilities v1.1.

bool Qtilities::CoreGui::ObserverWidget::lazyInitEnabled ( ) const

Gets if lazy initialization is enabled.

See also:
toggleLazyInit()

This function was added in Qtilities v1.1.

const QObject* Qtilities::CoreGui::ObserverWidget::objectBase ( ) const
inlinevirtual

Returns a const QObject* base of the interface.

This function can be used in const methods, but make sure that you don't modify things that should stay const. An example where this is used is when we want to get a property on an object in a const method. This is a const operation.

Implements Qtilities::Core::Interfaces::IObjectBase.

Qtilities::CoreGui::ObjectPropertyBrowser * Qtilities::CoreGui::ObserverWidget::propertyBrowser ( )

Returns the property editor used inside the observer widget. This can be 0 depending on the display flags used. Always call this function after initialize().

See also:
propertyBrowserDock(), dynamicPropertyBrowserDock(), dynamicPropertyBrowser()
QDockWidget * Qtilities::CoreGui::ObserverWidget::propertyBrowserDock ( )

Returns the dock widget containing the property browser.

See also:
propertyBrowser(), dynamicPropertyBrowserDock(), dynamicPropertyBrowser()
bool Qtilities::CoreGui::ObserverWidget::readOnly ( ) const

Gets if this widget must be read only, thus its actions and property editor will be read only.

See also:
setReadOnly(), readOnlyStateChanged()
void Qtilities::CoreGui::ObserverWidget::readOnlyStateChanged ( bool  read_only)
signal

Signal which is emitted when this widget's read only state changes.

See also:
readOnly(), setReadOnly()
void Qtilities::CoreGui::ObserverWidget::readSettings ( )
virtual

Restores the widget to a previous state.

Note:
This function must be called only after initialize() was called.

For more information about the saving of settings by Qtilities classes, see Configuration settings storage in Qtilities.

See also:
writeSettings(), globalMetaType()
void Qtilities::CoreGui::ObserverWidget::refresh ( )
virtualslot

Refreshes the current item view.

This function will emit the refreshViewsData() signal on the top level observer context. The refresh operation will be followed by calling selectObjects() with the same objects which were selected before calling this function was called. The function will then call refreshAction() before it exists.

See also:
topLevelObserverID(), addActionNewItem_triggered(), refreshActions();
void Qtilities::CoreGui::ObserverWidget::refreshDynamicPropertyBrowser ( )
protected

Refreshes the dynamic property browser, thus hide or show it depending on the active display flags.

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::resizeTableViewRows ( int  height = -1)
slot

Slot which resizes the rows in table view mode.

Slot which resizes the rows in table view mode.

Parameters:
heightThe height which must be used. By default the default row heigth of 17 pixels is used.
See also:
defaultRowHeight(), setDefaultRowHeight()
Qtilities::CoreGui::ObserverTreeItem::TreeItemTypeFlags Qtilities::CoreGui::ObserverWidget::searchBoxCheckedItemFilters ( ) const
slot

Gets the active item type filters in the menu on the search box widget used in this ObserverWidget.

By default, ObserverTreeItem::TreeItem

See also:
setSearchBoxCheckedItemFilters(), toggleSearchBox()

This function was added in Qtilities v1.2.

Qtilities::CoreGui::SearchBoxWidget * Qtilities::CoreGui::ObserverWidget::searchBoxWidget ( )

Returns the SearchBoxWidget contained inside the observer widget.

Returns:
The search box widget instance, if it does not exist null is returned.
void Qtilities::CoreGui::ObserverWidget::selectCategories ( QList< QtilitiesCategory categories)
slot

Selects the specified categories in the active item view.

Parameters:
categoriesThe categories that must be selected. If any categories in the list are not present in the view, they will be ignored. If the list is empty, nothing will happen.
See also:
selectedObjectsChanged(), clearSelection(), selectObject(), selectObjects(), selectCategory()

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::selectCategory ( QtilitiesCategory  category)
slot

Selects the specified object in the active item view.

Parameters:
categoryThe category that must be selected. If the category is not present in the view, it will be ignored.
Note:
This function does not respect the ObserverHints::ActivityControl::FollowSelection hint. You must do this manually.
This function only does something when displayMode() is Qtilities::TreeView.
See also:
selectedObjectsChanged(), clearSelection(), selectObject(), selectObjects(), selectCategories()

This function was added in Qtilities v1.1.

QList< QObject * > Qtilities::CoreGui::ObserverWidget::selectedObjects ( ) const

Provides a list of QObject pointers to all the selected objects.

See also:
selectedObjectsChanged()
bool Qtilities::CoreGui::ObserverWidget::selectedObjectsContextMatch ( ) const

Checks if all current selectedObjects() are in the same context.

See also:
selectedObjectsChanged(), selectedObjects()

This function was added in Qtilities v1.1.

bool Qtilities::CoreGui::ObserverWidget::selectedObjectsHintsMatch ( ) const

Checks if all current selectedObjects() share the same ObserverHints.

When selectedObjectsContextMatch() is false, this function allows you to check if all selected subjects shares the same hints. This can happen in two scenarios:

  • When usesObserverHints() is false the hints of all subjects will always match.
  • When the selected objects have observer parents with exactly the same hints.
See also:
selectedObjectsChanged(), selectedObjects()

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::selectionDelete ( )
virtualslot

Deletes the current selected items.

See also:
selectedObjects(), selectedObjectsChanged(), setConfirmDeletes(), confirmDeletes()
void Qtilities::CoreGui::ObserverWidget::selectionDeleteAll ( )
virtualslot

Deletes all subjects under the current selection parent or in the selected context.

See also:
selectionParent(), selectedObjects(), selectedObjectsChanged(), setConfirmDeletes(), confirmDeletes()
void Qtilities::CoreGui::ObserverWidget::selectionDetach ( )
virtualslot

Detaches the current selected objects in the item view from the current selection parent.

See also:
selectionParent(), selectedObjects(), selectedObjectsChanged()
void Qtilities::CoreGui::ObserverWidget::selectionDetachAll ( )
virtualslot

Detaches all subjects from the current selection parent.

See also:
selectionParent(), selectedObjects(), selectedObjectsChanged()
void Qtilities::CoreGui::ObserverWidget::selectionPushDown ( )
virtualslot

In TableView mode this function can be used to push down into (set the observer context of the widget) to the current selected observer.

This function only does something if an observer or an object which contains an observer is selected.

See also:
selectionParent(), selectionPushDownNew()
void Qtilities::CoreGui::ObserverWidget::selectionPushDownNew ( )
virtualslot

In TableView mode this function can be used to push down into (set the observer context of the widget) to the current selected observer in a new ObserverWidget.

This function only does something if an observer or an object which contains an observer is selected.

See also:
selectionParent(), selectionPushDown()
void Qtilities::CoreGui::ObserverWidget::selectionPushUp ( )
virtualslot

In TableView mode this function can be used to push up to (set the observer context of the widget) to the current selection parent.

See also:
selectionParent(), selectionPushUpNew()
void Qtilities::CoreGui::ObserverWidget::selectionPushUpNew ( )
virtualslot

In TableView mode this function can be used to push up to (set the observer context of the widget) to the current selection parent in a new ObserverWidget.

See also:
selectionParent(), selectionPushUp()
void Qtilities::CoreGui::ObserverWidget::selectObject ( QObject *  object)
slot

Selects the specified object in the active item view.

Parameters:
objectThe object that must be selected. If the object is not present in the view, it will be ignored.
Note:
This function does not respect the ObserverHints::ActivityControl::FollowSelection hint. You must do this manually.
See also:
selectedObjectsChanged(), clearSelection(), selectObjects(), selectCategories(), selectCategory()
void Qtilities::CoreGui::ObserverWidget::selectObjects ( QList< QObject * >  objects)
slot

Selects the specified objects in the active item view.

Parameters:
objectsThe objects that must be selected. If any objects in the list are not present in the view, they will be ignored. If the list is empty, nothing will happen.
Note:
This function does not respect the ObserverHints::ActivityControl::FollowSelection hint. You must do this manually.
See also:
selectedObjectsChanged(), clearSelection(), selectObject(), selectCategories(), selectCategory()
void Qtilities::CoreGui::ObserverWidget::selectObjects ( QList< QPointer< QObject > >  objects)
slot

Selects the specified objects in a smart pointer list in the active item view.

Parameters:
objectsThe objects that must be selected. If any objects in the list are not present in the view, they will be ignored. If the list is empty, the current selection will be cleared (or you could use clearSelection()).
Note:
This function does not respect the ObserverHints::ActivityControl::FollowSelection hint. You must do this manually.
See also:
selectedObjectsChanged(), clearSelection(), selectObject()
void Qtilities::CoreGui::ObserverWidget::setConfirmDeletes ( bool  confirm_deletes)

Function to set the interaction with the user when deleting subjects.

See also:
confirmDeletes(), selectionDelete(), selectionDeleteAll()
bool Qtilities::CoreGui::ObserverWidget::setCustomHints ( ObserverHints custom_hints)

This function allows you to copy the custom hints used by this ObserverWidget from a different ObserverHints instance.

This functions copies the hints provided by custom_hints, thus it does not manage the lifetime of the custom_hints instance passed to it.

Note:
These custom hints are only used when usesObserverHints() is false.
Returns:
True if successfull, false otherwise.
See also:
toggleUseObserverHints(), activeHints()
bool Qtilities::CoreGui::ObserverWidget::setCustomTableModel ( ObserverTableModel table_model)

Function which sets a custom table model to be used in this widget when its in TableView mode.

By default the observer widget uses the Qtilities::CoreGui::ObserverTableModel as the model for the table view. It is possible to use custom models which allows you to extend the default table model.

Note:
This function must be called before initializing the widget for the first time.

The observer widget will manage the lifetime of the custom model.

Returns:
True if the model was successfully set.
bool Qtilities::CoreGui::ObserverWidget::setCustomTableProxyModel ( QAbstractProxyModel *  proxy_model)

Function which sets a custom table proxy model to be used in this widget when its in TableView mode.

By default the observer widget uses the Qtilities::CoreGui::ObserverTableModelProxyFilter as the proxy model for the table view. It is possible to use custom proxy models which allows you to extend the default proxy model.

The observer widget will manage the lifetime of the custom model.

Note:
This function must be called before initializing the widget for the first time.
Returns:
True if the proxy model was successfully set.
bool Qtilities::CoreGui::ObserverWidget::setCustomTreeModel ( ObserverTreeModel tree_model)

Function which sets a custom tree model to be used in this widget when its in TreeView mode.

By default the observer widget uses the Qtilities::CoreGui::ObserverTreeModel as the model for the tree view. It is possible to use custom models which allows you to extend the default tree model.

The observer widget will manage the lifetime of the custom model.

Note:
This function must be called before initializing the widget for the first time.
Returns:
True if the model was successfully set.
bool Qtilities::CoreGui::ObserverWidget::setCustomTreeProxyModel ( QAbstractProxyModel *  proxy_model)

Function which sets a custom tree proxy model to be used in this widget when its in TreeView mode.

By default the observer widget uses the Qtilities::CoreGui::ObserverTreeModelProxyFilter as the proxy model for the tree view. It is possible to use custom proxy models which allows you to extend the default proxy model.

The observer widget will manage the lifetime of the custom model.

Note:
This function must be called before initializing the widget for the first time.
Returns:
True if the proxy model was successfully set.
void Qtilities::CoreGui::ObserverWidget::setDefaultRowHeight ( int  height)

Function to set the default height used for the table view when this widget is used in TableView mode.

The default is 17.

See also:
defaultRowHeight()
void Qtilities::CoreGui::ObserverWidget::setDisplayMode ( DisplayMode  display_mode)

Sets the display mode of the widget.

See also:
displayMode(), toggleDisplayMode()
void Qtilities::CoreGui::ObserverWidget::setDragDropCopyButton ( Qt::MouseButton  mouse_button)

Sets the mouse button to use for drag and drop copy operations.

Setting the button to Qt::NoButton disables the copy drag/drop functionality.

See also:
dragDropCopyButton()
void Qtilities::CoreGui::ObserverWidget::setDragDropMoveButton ( Qt::MouseButton  mouse_button)

Sets the mouse button to use for drag and drop move operations.

Setting the button to Qt::NoButton disables the move drag/drop functionality.

See also:
dragDropMoveButton()
bool Qtilities::CoreGui::ObserverWidget::setGlobalMetaType ( const QString &  meta_type)

Sets the global meta type used for this observer widget.

Returns:
True if the meta_type string was valid. The validity check is done by checking if that a context with the same name does not yet exist in the context manager.
See also:
globalMetaType(), sharedGlobalMetaType()
void Qtilities::CoreGui::ObserverWidget::setNavigationStack ( QStack< int >  navigation_stack)

Allows you to set the navigation stack of this widget.

The navigation stack keeps track of the user's navigation history of events related to pushing down into observers and pushing up into parents of observers. Using this function you can initialize the widget using a predefined stack. The stack stores IDs of observers assigned by the Qtilities::CoreGui::ObjectManager singleton.

See also:
void Qtilities::CoreGui::ObserverWidget::setPreferredDynamicPropertyEditorDockArea ( Qt::DockWidgetArea  property_editor_dock_area)
slot

Sets the desired area of the dynamic property editor (if it is used by the observer context).

This area will be used to position the dynamic property editor dock widget when the widget is first shown during a session. Afterwards the widget will remember where the dock widget is.

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::setPreferredDynamicPropertyEditorType ( ObjectDynamicPropertyBrowser::BrowserType  property_editor_type)
slot

Sets the desired type of the dynamic property editor (if it is used by the observer context).

The dynamic property editor type must be set before calling initialize().

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::setPreferredPropertyEditorDockArea ( Qt::DockWidgetArea  property_editor_dock_area)
slot

Sets the desired area of the property editor (if it is used by the observer context).

This area will be used to position the property editor dock widget when the widget is first shown during a session. Afterwards the widget will remember where the dock widget is.

void Qtilities::CoreGui::ObserverWidget::setPreferredPropertyEditorType ( ObjectPropertyBrowser::BrowserType  property_editor_type)
slot

Sets the desired type of the property editor (if it is used by the observer context).

The property editor type must be set before calling initialize().

void Qtilities::CoreGui::ObserverWidget::setReadOnly ( bool  read_only)
virtual

Sets if this widget must be read only, thus its actions and property editor will be read only.

Note:
Make sure you only call this function after the widget has been initialized through initialize().
See also:
readOnly(), readOnlyStateChanged()
void Qtilities::CoreGui::ObserverWidget::setSearchBoxCheckedItemFilters ( ObserverTreeItem::TreeItemTypeFlags  item_filter_flags)
slot

Sets the active item type filters in the menu on the search box widget used in this ObserverWidget.

See also:
searchBoxCheckedItemFilters(), toggleSearchBox()

This function was added in Qtilities v1.2.

void Qtilities::CoreGui::ObserverWidget::setSharedGlobalMetaType ( const QString &  shared_meta_type)

Function which allows this observer widget to share global object activity with other observer widgets.

This function will allow this observer widget to share global object activity with other observer widgets. Because the globalMetaType() for each observer widget must be unique, it is required to use a shared meta type for cases where global object activity needs to be shared between multiple observer widgets.

When using a shared global activity meta type, the normal globalMetaType() will be used for all the normal usage scenarios listed in the globalMetaType() documentation, except for the meta type used to identify a set of active objects in the object manager.

See also:
sharedGlobalMetaType(), globalMetaType(), setGlobalMetaType(), updateGlobalActiveSubjects()
void Qtilities::CoreGui::ObserverWidget::setTreeExpandCollapseVisible ( bool  is_visible)

Sets if the "Expand All"/"Collapse All" actions should be visible when in TreeView mode.

See also:
treeExpandCollapseVisible()

This function was added in Qtilities v1.2.

QString Qtilities::CoreGui::ObserverWidget::sharedGlobalMetaType ( ) const

Function to get the shared global activity meta type of this observer widget.

Returns:
The shared global activity meta type. If this feature is not used, QString() will be returned.
See also:
sharedGlobalMetaType(), globalMetaType(), setGlobalMetaType(), updateGlobalActiveSubjects()
QTableView * Qtilities::CoreGui::ObserverWidget::tableView ( )

Function providing access to the contained table view.

Note:
This reference is only valid in TableView mode.
See also:
treeView(), view()
void Qtilities::CoreGui::ObserverWidget::toggleDisplayMode ( )
virtualslot

Toggles the display mode of the ObserverWidget.

See also:
setDisplayMode(), displayMode()
void Qtilities::CoreGui::ObserverWidget::toggleLazyInit ( bool  enabled)

Enables/disables lazy initialization.

Lazy initialization means that the internal item view model won't initialize itself during the initialize() call. Its usefull when using custom implemented proxy models etc. To initialize the model in lazy initialization mode call refresh().

Lazy initialization is disabled by default.

Note:
You must call this function before initialize() for it to have any effect.
Only usefull when in TreeView mode, in TableView mode this does not have any effect.
After initialization lazy initialization is always turned off in order for display mode switching to work properly.
See also:
lazyInitEnabled()

This function was added in Qtilities v1.1.

void Qtilities::CoreGui::ObserverWidget::toggleSearchBox ( )
slot

Toggles the visibility of the SearchBoxWidget at the bottom of the ObserverWidget.

Note:
When proxy models are disabled, the search box is not available and this function does nothing. See disableProxyModels().
See also:
setCheckedSearchBoxItemFilters()
void Qtilities::CoreGui::ObserverWidget::toggleUseGlobalActiveObjects ( bool  toggle)

Function to toggle if this observer widget updates global active objects under its globalMetaType() meta type.

For more information on global active objects, see the Global object activity management section of the Object Management article.

See also:
useGlobalActiveObjects
void Qtilities::CoreGui::ObserverWidget::toggleUseObserverHints ( bool  toggle)

Function to toggle usage of hints from the active parent observer. If not default hints will be used.

See also:
activeHints(), setCustomHints()
bool Qtilities::CoreGui::ObserverWidget::treeExpandCollapseVisible ( ) const

Gets if the "Expand All"/"Collapse All" actions should be visible when in TreeView mode.

*This is true by default.

See also:
setTreeExpandCollapseVisible()

This function was added in Qtilities v1.2.

QTreeView * Qtilities::CoreGui::ObserverWidget::treeView ( )

Function providing access to the contained tree view.

Note:
This reference is only valid in TreeView mode.
See also:
tableView(), view()
void Qtilities::CoreGui::ObserverWidget::updateGlobalActiveSubjects ( )

Sets the global object subject type used by this observer widget.

If objects are selected, they are set as the active objects. If no objects are selected, the observer context is set as the active object.

For more information see the Global object activity management section of the Object Management article.

bool Qtilities::CoreGui::ObserverWidget::useGlobalActiveObjects ( ) const

Indicates if this observer widget updates global active objects.

See also:
toggleUseGlobalActiveObjects();
QAbstractItemView * Qtilities::CoreGui::ObserverWidget::view ( )

Function providing access to the QAbstractItemView view base class.

This function is usefull when you want to access functionality on the current view which is common to both QTreeView and QTableView, without needing to care about the view type.

Note:
This reference is only valid in TreeView and TableView modes.
See also:
tableView(), treeView()

This function was added in Qtilities v1.2.

void Qtilities::CoreGui::ObserverWidget::writeSettings ( )
virtualslot

Slot connected to QCoreApplication::aboutToQuit() signal.

Saves settings about this ObserverWidget instance using QSettings. The following parameters are saved:

See also:
readSettings(), globalMetaType()


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé