All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Signals | Public Member Functions | Static Public Member Functions
Qtilities::Core::ObserverHints Class Reference

The ObserverHints class contains display hints for an Observer class. More...

#include <ObserverHints.h>

Inheritance diagram for Qtilities::Core::ObserverHints:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ActionItem {
  ActionNoHints = 0, ActionRemoveItem = 1, ActionRemoveAll = 2, ActionDeleteItem = 4,
  ActionDeleteAll = 8, ActionNewItem = 32, ActionRefreshView = 64, ActionPushUp = 128,
  ActionPushUpNew = 256, ActionPushDown = 512, ActionPushDownNew = 1024, ActionSwitchView = 2048,
  ActionCopyItem = 4096, ActionCutItem = 8192, ActionPasteItem = 16384, ActionFindItem = 32768,
  ActionAllHints = ActionRemoveItem | ActionRemoveAll | ActionDeleteItem | ActionDeleteAll | ActionNewItem | ActionRefreshView | ActionPushUp | ActionPushUpNew | ActionPushDown | ActionPushDownNew | ActionSwitchView | ActionCopyItem | ActionCutItem | ActionPasteItem | ActionFindItem
}
 The possible actions which views can perform on an observer. The ObserverWidget class provides the applicable actions through an IActionProvider interface and handles all these actions already. More...
enum  ActivityControl { NoActivityControlHint = 0, NoActivityControl = 1, FollowSelection = 2, CheckboxTriggered = 3 }
 The possible activity control hints. More...
enum  ActivityDisplay { NoActivityDisplayHint = 0, NoActivityDisplay = 1, CheckboxActivityDisplay = 2 }
 The possible activity display hints. More...
enum  CategoryEditingHint {
  CategoriesNoEditingFlags = 0, CategoriesReadOnly = 1, CategoriesEditableTopLevel = 2, CategoriesEditableAllLevels = 4,
  CategoriesAcceptSubjectDrops = 8
}
 The possible category editing hints. More...
enum  DisplayFlag {
  NoDisplayFlagsHint = 3, ItemView = 1, NavigationBar = 2, PropertyBrowser = 4,
  ActionToolBar = 8, DynamicPropertyBrowser = 16
}
 The possible display flags of the observer. More...
enum  DragDropHint { NoDragDrop = 0, AcceptDrops = 1, AllowDrags = 2 }
 The possible drag drop hints for an observer context. More...
enum  HierarchicalDisplay { NoHierarchicalDisplayHint = 0, FlatHierarchy = 1, CategorizedHierarchy = 2 }
 The possible hierarchical display hints. More...
enum  ItemSelectionControl { NoItemSelectionControlHint = 0, SelectableItems = 1, NonSelectableItems = 2 }
 The possible item selection control hints. More...
enum  ItemViewColumn {
  ColumnNoHints = 1, ColumnNameHint = 1, ColumnIDHint = 2, ColumnChildCountHint = 4,
  ColumnTypeInfoHint = 8, ColumnAccessHint = 16, ColumnCategoryHint = 32, ColumnAllHints = ColumnNameHint | ColumnChildCountHint | ColumnTypeInfoHint | ColumnAccessHint | ColumnCategoryHint
}
 The possible item view column hints. More...
enum  ModificationStateDisplayHint { NoModificationStateDisplayHint = 0, CharacterModificationStateDisplay = 1 }
 The possible modification state display hints. More...
enum  NamingControl { NoNamingControlHint = 0, ReadOnlyNames = 1, EditableNames = 2 }
 The possible naming control hints of the observer. More...
enum  ObserverSelectionContext { NoObserverSelectionContextHint = 0, SelectionUseParentContext = 1, SelectionUseSelectedContext = 2 }
 The observer selection context hint provides the ability to specify the context which must be used when selecting an observer in an observer tree hierarchy. More...
enum  RootIndexDisplayHint { RootIndexHide = 0, RootIndexDisplayDecorated = 1, RootIndexDisplayUndecorated = 2 }
 The root index display hint of the observer. More...
- Public Types inherited from Qtilities::Core::Interfaces::IModificationNotifier
enum  NotificationTarget { NotifyNone = 0, NotifyListeners = 1, NotifySubjects = 2 }
 The targets which should be notified when the state of the object implementing this interface changes. More...
- Public Types inherited from Qtilities::Core::Interfaces::IExportable
enum  ExportMode { None = 0, Binary = 1, XML = 2 }
 Possible export modes that an implementation of IExportable can support. More...
enum  Result {
  Complete = 0, Incomplete = 1, Failed = 2, FailedContinue = 4,
  VersionTooNew = 8, VersionTooOld = 16, VersionSupported = 32, SuccessResult = Complete | Incomplete | VersionSupported,
  FailedResult = Failed | FailedContinue | VersionTooNew | VersionTooOld
}
 The possible results of an export/import operation. More...

Signals

void modificationStateChanged (bool is_modified) const
 Implement this function as a signal when implementing the object.

Public Member Functions

ObserverHints::ActionHints actionHints () const
 Function to get the action hint for this observer's context.
ObserverHints::ActivityControl activityControlHint () const
 Gets the activity control hint.
ObserverHints::ActivityDisplay activityDisplayHint () const
 Gets the activity display hint.
void addDisplayedCategory (const QtilitiesCategory &category)
 Adds a displayed category to the list of displayed categories.
ObserverHints::CategoryEditingFlags categoryEditingFlags () const
 Function to get the category editing display hint for this observer's context.
bool categoryFilterEnabled () const
 Returns true if the category filter is enabled, false otherwise. The default is false.
QList< QtilitiesCategorydisplayedCategories () const
 Returns the displayed categories list. Note that this function does not take inversed filtering, or if filtering is enabled into account.
ObserverHints::DisplayFlags displayFlagsHint () const
 Function to get current display flags hint.
ObserverHints::DragDropFlags dragDropHint () const
 Function to get the drag drop hint for this observer's context.
IExportable::ExportResultFlags exportBinary (QDataStream &stream) const
 Allows exporting to a QDataStream.
IExportable::ExportResultFlags exportXml (QDomDocument *doc, QDomElement *object_node) const
 Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument.
bool hasInversedCategoryDisplay () const
 Returns true if the displayed categories list is inversed. The default is true.
ObserverHints::HierarchicalDisplay hierarchicalDisplayHint () const
 Gets the hierarchical display hint for this model.
IExportable::ExportResultFlags importBinary (QDataStream &stream, QList< QPointer< QObject > > &import_list)
 Allows importing and reconstruction of the object state from information provided in a QDataStream.
IExportable::ExportResultFlags importXml (QDomDocument *doc, QDomElement *object_node, QList< QPointer< QObject > > &import_list)
 Allows importing and reconstruction of data from information provided in a XML document. A reference to the QDomElement which contains the object's information is provided, along with a reference to the QDomDocument.
InstanceFactoryInfo instanceFactoryInfo () const
 The instance factory information which must be used when the exported object is reconstructed during an import.
bool isModified () const
 Indicates the modification state of the object.
ObserverHints::ItemSelectionControl itemSelectionControlHint () const
 Gets the selection control hint.
ObserverHints::ItemViewColumnFlags itemViewColumnHint () const
 Function to get item view column display hints.
ObserverHints::ModificationStateDisplayHint modificationStateDisplayHint () const
 Function to get the modification state display hint for this observer's context.
ObserverHints::NamingControl namingControlHint () const
 Gets the naming control hint.
QObject * objectBase ()
 Returns the QObject* base of the interface.
const QObject * objectBase () const
 Returns a const QObject* base of the interface.
 ObserverHints (QObject *parent=0)
 Default constructor.
 ObserverHints (const ObserverHints &other)
 Copy constructor.
ObserverHints::ObserverSelectionContext observerSelectionContextHint () const
 Gets the observer selection context hint.
void removeDisplayedCategory (const QtilitiesCategory &category)
 Removes a displayed category to the list of displayed categories.
ObserverHints::RootIndexDisplayHint rootIndexDisplayHint () const
 Function to get the category editing display hint for this observer's context.
void setActionHints (ObserverHints::ActionHints action_hints)
 Function to set the action hint for this observer's context.
void setActivityControlHint (ObserverHints::ActivityControl activity_control)
 Sets the activity control hint.
void setActivityDisplayHint (ObserverHints::ActivityDisplay activity_display)
 Sets the activity display hint.
void setCategoryEditingFlags (ObserverHints::CategoryEditingFlags category_editing_flags)
 Function to set the category editing display hint for this observer's context.
void setCategoryFilterEnabled (bool enabled)
 Returns true if the displayed categories list is inversed. The default is true.
void setDisplayedCategories (const QList< QtilitiesCategory > &displayed_categories, bool inversed=false)
 Function to set the categories you want to be displayed in item views viewing this observer.
void setDisplayFlagsHint (ObserverHints::DisplayFlags display_flags)
 Function to set display flags hint.
void setDragDropHint (ObserverHints::DragDropFlags drag_drop_flags)
 Function to set the drag drop hint for this observer's context.
void setHierarchicalDisplayHint (ObserverHints::HierarchicalDisplay hierarhical_display)
 Sets the hierarchical display hint for this model.
void setItemSelectionControlHint (ObserverHints::ItemSelectionControl item_selection_control)
 Sets the selection control hint.
void setItemViewColumnHint (ObserverHints::ItemViewColumnFlags item_view_column_hint)
 Function to set item view column display hints.
void setModificationStateDisplayHint (ObserverHints::ModificationStateDisplayHint modification_state_display)
 Function to set the modification state display hint for this observer's context.
void setNamingControlHint (ObserverHints::NamingControl naming_control)
 Sets the naming control hint.
void setObserverSelectionContextHint (ObserverHints::ObserverSelectionContext observer_selection_context)
 Sets the observer selection context hint.
void setRootIndexDisplayHint (ObserverHints::RootIndexDisplayHint root_index_display_hint)
 Function to set the root index display hint for this observer's context.
IExportable::ExportModeFlags supportedFormats () const
 Provides information about the export format(s) supported by your implementation of IExportable.
virtual ~ObserverHints ()
 Destructor.
- Public Member Functions inherited from Qtilities::Core::ObserverAwareBase
ObserverobserverContext () const
 Gets a pointer to the observer context.
virtual bool setObserverContext (Observer *observer_ptr)
 Sets the observer context.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IModificationNotifier
virtual void setModificationState (bool new_state, NotificationTargets notification_targets=NotifyListeners, bool force_notifications=false)=0
 Sets the modification state of the object. Returns true if it was successfull.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable
quint32 applicationExportVersion () const
 Returns the application export version currently used by all your application's classes.
virtual void clearExportTask ()
 Clears the export task.
IExportableduplicate (QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0) const
 Function which will create a duplicate (copy) of this object.
virtual ITaskexportTask () const
 Gets the task which must be used to log import/export information to.
Qtilities::ExportVersion exportVersion () const
 Returns the export version currently used by all Qtilities classes.
bool isExportable () const
 Gets if this object must be part of it's parents' exports.
virtual void setApplicationExportVersion (quint32 version)
 Sets the application export version currently used by all your application's classes.
virtual void setExportTask (ITask *task)
 Sets the task which must be used to log import/export information to.
virtual void setExportVersion (Qtilities::ExportVersion version)
 Returns the export version currently used by all Qtilities classes.
virtual void setIsExportable (bool new_is_exportable)
 Sets if this object must be part of it's parents' exports.

Static Public Member Functions

static QString actionHintsToString (ActionHints actions_hints)
 Function which returns a string associated with a specific ActionHints.
static QString activityControlToString (ActivityControl activity_control)
 Function which returns a string associated with a specific ActivityControl.
static QString activityDisplayToString (ActivityDisplay activity_display)
 Function which returns a string associated with a specific ActivityDisplay.
static QString categoryEditingFlagsToString (CategoryEditingFlags category_editing_flags)
 Function which returns a string associated with a specific CategoryEditingFlags.
static QString displayFlagsToString (DisplayFlags display_flags)
 Function which returns a string associated with a specific DisplayFlags.
static QString dragDropFlagsToString (DragDropFlags drag_drop_flags)
 Function which returns a string associated with a specific DragDropFlags.
static QString hierarchicalDisplayToString (HierarchicalDisplay hierarchical_display)
 Function which returns a string associated with a specific HierarchicalDisplay.
static QString itemSelectionControlToString (ItemSelectionControl item_selection_control)
 Function which returns a string associated with a specific ItemSelectionControl.
static QString itemViewColumnFlagsToString (ItemViewColumnFlags item_view_column_flags)
 Function which returns a string associated with a specific ItemViewColumnFlags.
static QString modificationStateDisplayToString (ModificationStateDisplayHint modification_display)
 Function which returns a string associated with a specific ModificationStateDisplayHint.
static QString namingControlToString (NamingControl naming_control)
 Function which returns a string associated with a specific NamingControl.
static QString observerSelectionContextToString (ObserverSelectionContext observer_selection_context)
 Function which returns a string associated with a specific ObserverSelectionContext.
static QString rootIndexDisplayHintToString (RootIndexDisplayHint root_index_display_hint)
 Function which returns a string associated with a specific RootIndexDisplayHint.
static ActionHints stringToActionHints (const QString &actions_hints_string)
 Function which returns the ActionHints associated with a string.
static ActivityControl stringToActivityControl (const QString &activity_control_string)
 Function which returns the ActivityControl associated with a string.
static ActivityDisplay stringToActivityDisplay (const QString &activity_display_string)
 Function which returns the ActivityDisplay associated with a string.
static CategoryEditingFlags stringToCategoryEditingFlags (const QString &category_editing_flags)
 Function which returns the CategoryEditingFlags associated with a string.
static DisplayFlags stringToDisplayFlags (const QString &display_flags_string)
 Function which returns the DisplayFlags associated with a string.
static DragDropFlags stringToDragDropFlags (const QString &drag_drop_flags_string)
 Function which returns the DragDropFlags associated with a string.
static HierarchicalDisplay stringToHierarchicalDisplay (const QString &hierarchical_display_string)
 Function which returns the HierarchicalDisplay associated with a string.
static ItemSelectionControl stringToItemSelectionControl (const QString &item_selection_control_string)
 Function which returns the ItemSelectionControl associated with a string.
static ItemViewColumnFlags stringToItemViewColumnFlags (const QString &item_view_column_flags_string)
 Function which returns the ItemViewColumnFlags associated with a string.
static ModificationStateDisplayHint stringToModificationStateDisplay (const QString &modification_display_string)
 Function which returns the ModificationStateDisplayHint associated with a string.
static NamingControl stringToNamingControl (const QString &naming_control_string)
 Function which returns the NamingControl associated with a string.
static ObserverSelectionContext stringToObserverSelectionContext (const QString &observer_selection_context_string)
 Function which returns the ObserverSelectionContext associated with a string.
static RootIndexDisplayHint stringToRootIndexDisplayHint (const QString &root_index_display_hint_string)
 Function which returns the RootIndexDisplayHint associated with a string.
- Static Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable
template<typename T >
static T * duplicateInstance (IExportable *obj, QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0)
 Provides an easy to use template based implementation of IExportable::duplicate().
static QString exportModeToString (ExportMode export_mode)
 Function which returns a string associated with a specific ExportMode.
static ExportMode stringToExportMode (const QString &export_mode_string)
 Function which returns the ExportMode associated with a string.
static Result validateQtilitiesExportVersion (Qtilities::ExportVersion export_version, ITask *task=0)
 Checks the exportVersion() against the supported Qtilities export versions for the current Qtilities version.
static Result validateQtilitiesImportVersion (Qtilities::ExportVersion import_version, ITask *task=0)
 Checks the exportVersion() against the supported Qtilities import versions for the current Qtilities version.

Detailed Description

The ObserverHints class contains display hints for an Observer class.

The ObserverHints class contains display hints for an Observer class. When an application uses observer hints, all item views displaying observer contexts should respect the hints provided by the ObserverHints object associated with an Observer.

When an ObserverHints object is constructed and it is given an observer context (see ObserverHints()), it will automatically send modification state changes to the observer when hints are changed. It is also possible to create an ObserverHints class without an observer context in which case no interaction will happen with the observer since it is not present.

When using an observer in a GUI application, you can either set the ObserverHints which must be used by your observer using the Qtilities::Core::Observer::setDisplayHints() or you can construct a default ObserverHints object using the Qtilities::Core::Observer::useDisplayHints() function in which case the default values as shown in ObserverHints().

See also:
Observer, ObserverData

Member Enumeration Documentation

The possible actions which views can perform on an observer. The ObserverWidget class provides the applicable actions through an IActionProvider interface and handles all these actions already.

See also:
setActionHints(), actionHints()
Enumerator:
ActionNoHints 

No actions are allowed.

ActionRemoveItem 

Allow detachment of subjects from the observer context presented to the user.

ActionRemoveAll 

Allow detachment of all subjects from the observer context presented to the user.

Note:
ObserverWidget only handles this action if a single object is selected.
ActionDeleteItem 

Allow deleting subjects from the observer context presented to the user.

ActionDeleteAll 

Allow deleting of all subjects from the observer context presented to the user.

Note:
ObserverWidget only handles this action if a single object is selected.
ActionNewItem 

Allow new items to be added to the observer context presented to the user.

ActionRefreshView 

Allow refreshing of views.

ActionPushUp 

Allow pushing up in the hierarchy of the displayed observer context in TableViews.

ActionPushUpNew 

Allow pushing up into a new window in the hierarchy of the displayed observer context in TableViews.

ActionPushDown 

Allow pushing down in the hierarchy of the displayed observer context in TableViews.

ActionPushDownNew 

Allow pushing down into a new window in the hierarchy of the displayed observer context in TableViews.

ActionSwitchView 

Allow switching between different view modes (TableView and TreeView) for example. When switching from tree to table view mode, the current active context is used for the table view, unless an observer with the ObserverHints::SelectionUseSelectedContext is selected.

ActionCopyItem 

Allow copy operations which will add details about the selected items in the view to the clipboard using the ObserverMimeData class.

ActionCutItem 

Allow cut operations similar to the copy operation, the items are just detached from the current context when added to a new context.

ActionPasteItem 

Allow pasting of ObserverMimeData into the observer context presented to the user.

ActionFindItem 

Allow finding/searching in the observer context presented to the user.

ActionAllHints 

All actions.

The possible activity control hints.

See also:
setActivityControlHint(), activityControlHint()
Enumerator:
NoActivityControlHint 

No activity control hint. Uses NoActivityControl by default.

NoActivityControl 

The activity of subjects cannot be changed by the user in item views viewing this observer.

FollowSelection 

The activity of subjects follows the selection of the user in item views viewing this observer. To use this option, ItemSelectionControl must be set to SelectableItems.

CheckboxTriggered 

The activity of subjects can be changed by checking or unchecking the checkbox appearing next to subject in item views viewing this observer. To use this option, ActivityDisplay must be set to CheckboxActivityDisplay.

The possible activity display hints.

See also:
setActivityDisplayHint(), activityDisplayHint()
Enumerator:
NoActivityDisplayHint 

No activity display hint. Uses NoActivityDisplay by default.

NoActivityDisplay 

The activity of items are not displayed in item views viewing this observer.

CheckboxActivityDisplay 

If the observer has an ActivityPolicyFilter subject filter installed, a check box which shows the activity of subjects are shown in item views viewing this observer.

The possible category editing hints.

Note:
Only applicable when hierarchicalDisplayToString() is CategorizedHierarchy.
Category drops are enabled through CategoriesAcceptSubjectDrops which works independent of dragDropHint(). See categoryEditingFlags() for more information about category drops. Note that dragDropHint() must contain AllowDrags in order for category drag/drop operations to work.

Thus, to enable dragging items between categories, the following is needed:

node->displayHints()->setCategoryEditingFlags(ObserverHints::CategoriesEditableAllLevels |
node->displayHints()->setDragDropHint(ObserverHints::AllowDrags);
See also:
setCategoryEditingFlags(), categoryEditingFlags()
Enumerator:
CategoriesNoEditingFlags 

Categories are read only, double clicking on them expands/collapse them.

CategoriesReadOnly 

Categories are read only, double clicking on them expands/collapse them.

CategoriesEditableTopLevel 

Categories are editable, double clicking on them shows the top level category name to the user to edit.

CategoriesEditableAllLevels 

Categories are editable, double clicking on them shows all the category levels to the user to edit.

CategoriesAcceptSubjectDrops 

Categories accept subject(s) dropped onto them and assigns the dropped category to the subject(s).

The possible display flags of the observer.

See also:
setDisplayFlagsHint(), displayFlagsHint()
Enumerator:
NoDisplayFlagsHint 

No display flags hint. Uses ItemView | NavigationBar by default.

ItemView 

Display the item view (TreeView, TableView etc.). The item view is always displayed when using the Qtilities::CoreGui::ObserverWidget widget.

NavigationBar 

Display the navigation bar in TableViews.

PropertyBrowser 

Display the property browser using Qtilities::CoreGui::ObjectPropertyBrowser. When Qtilities is build without the QTILITIES_PROPERTY_BROWSER variable defined, this value is meaningless.

ActionToolBar 

Display an action toolbar in the observer widget with all the actions provided through Qtilities::CoreGui::ObserverWidget::actionProvider().

DynamicPropertyBrowser 

Display the property browser using Qtilities::CoreGui::ObjectDynamicPropertyBrowser. When Qtilities is build without the QTILITIES_PROPERTY_BROWSER variable defined, this value is meaningless.

The possible drag drop hints for an observer context.

This hint indicates if an observer context supports drag or/and drop operations of subjects.

Note:
Category drops works independent of dragDropHint(). See categoryEditingFlags() for more information about category drops. Note that dragDropHint() must contain AllowDrags in order for category drag/drop operations to work.
See also:
setDragDropHint(), dragDropHint()
Enumerator:
NoDragDrop 

No drag or drops allowed.

AcceptDrops 

This context accepts drops.

AllowDrags 

This context allows drags.

The possible hierarchical display hints.

See also:
setHierarchicalDisplayHint(), hierarchicalDisplayHint()
Enumerator:
NoHierarchicalDisplayHint 

No hierachical display hint. Uses FlatHierarchy by default.

FlatHierarchy 

The hierarchy of items under an observer is flat. Thus categories are not displayed.

CategorizedHierarchy 

Item are grouped by their category

The possible item selection control hints.

See also:
setItemSelectionControlHint(), itemSelectionControlHint()
Enumerator:
NoItemSelectionControlHint 

No item selection control hint. Uses NonSelectableItems by default.

SelectableItems 

Items are selectable by the user in item views viewing this observer.

NonSelectableItems 

Items are not selectable by the user in item views viewing this observer.

The possible item view column hints.

See also:
setItemViewColumnHint(), itemViewColumnHint()
Enumerator:
ColumnNoHints 

No item view column hint. Only the name column is shown in item views viewing this observer.

ColumnNameHint 

Shows a column with the name of the subject.

ColumnIDHint 

Shows a column with the subject IDs of subjects in item views viewing this observer.

ColumnChildCountHint 

Shows a column with the cumulative count (counts items under each subject recusively) of subjects under each subject in item views viewing this observer.

ColumnTypeInfoHint 

Shows a column with information about the type of subject in item views viewing this observer.

ColumnAccessHint 

Shows a column with information about the access type of the subject in item views viewing this observer.

ColumnCategoryHint 

Shows a column with information about the category of the subject in item views viewing this observer. Only used when CategorizedHierarchy hierachical display hint is used and only affects table models for the observer.

ColumnAllHints 

All columns, except ColumnIDHint.

The possible modification state display hints.

See also:
setModificationStateDisplayHint(), modificationStateDisplayHint()
Enumerator:
NoModificationStateDisplayHint 

No modification state display hint. The modification state is not displayed in any way.

CharacterModificationStateDisplay 

The modification state of items is displayed by appending a specific character "*" to names of modified items.

The possible naming control hints of the observer.

See also:
setNamingControlHint(), namingControlHint()
Enumerator:
NoNamingControlHint 

No naming control hint. Uses ReadOnlyNames by default.

ReadOnlyNames 

Names cannot be edited in item views viewing this observer.

EditableNames 

Names are editable in item views viewing this observer.

The observer selection context hint provides the ability to specify the context which must be used when selecting an observer in an observer tree hierarchy.

Without this hint, widgets which are viewing a context must make assumptions on what to do when an observer is selected in the view. For example, if you select an observer inside a context, should the ActionDeleteAll hint delete all objects under the selected observer or in the context where the observer is present (thus the observer's parent observer context).

When using different selection contexts in the same tree you should take care not to create actions which are confusing to users, thus the usages of all items in the tree must make sense and be consistant in the usage scenario.

This hint changes the behaviour of the following action handles in the Qtilities::CoreGui::ObserverWidget class:

Note:
This hint must be set on the observer which is selected. Thus if you set it on an observer the hint will only be respected for that observer, not any observers underneath it.
See also:
setObserverSelectionContextHint(), observerSelectionContextHint()
Enumerator:
NoObserverSelectionContextHint 

No observer selection context hint. Uses SelectionUseParentContext by default.

SelectionUseParentContext 

Use the parent observer's context.

SelectionUseSelectedContext 

Use the selected observer's context. Only enforced when a single selection is present in an ObserverWidget tree. When more items are selected SelectionUseParentContext will be used

The root index display hint of the observer.

This hint determines how the root node of the observer is shown in Qtilities::CoreGui::ObserverWidget when in Qtilities::TreeView mode.

The default is RootIndexHide.

See also:
rootIndexDisplayHintToString(), stringToRootIndexDisplayHint(), setRootIndexDisplayHint(), rootIndexDisplayHint()

This hint was added in Qtilities v1.2.

Enumerator:
RootIndexHide 

Don't display the root index. An example tree displayed using this hint can be seen below:

observer_hints_root_index_hide.jpg
Tree Displayed Using RootIndexHide
RootIndexDisplayDecorated 

Display the root index and decorate it. See QTreeView::rootIsDecorated() for more details on decoration. An example tree displayed using this hint can be seen below:

observer_hints_root_index_display_decorated.jpg
Tree Displayed Using RootIndexDisplayDecorated
RootIndexDisplayUndecorated 

Display the root index but don't decorate it. See QTreeView::rootIsDecorated() for more details on decoration. An example tree displayed using this hint can be seen below:

observer_hints_root_index_display_undecorated.jpg
Tree Displayed Using RootIndexDisplayUndecorated

Constructor & Destructor Documentation

Qtilities::Core::ObserverHints::ObserverHints ( QObject *  parent = 0)

Default constructor.

Parameters:
parentThe parent of the observer hint object. If the parent is an observer, setObserverContext() will automatically be called using the parent.

The defaults for all hints are initialized as shown below:

observer_selection_context(ObserverHints::SelectionUseParentContext),
item_selection_control(ObserverHints::SelectableItems),
display_flags(NoDisplayFlagsHint),
item_view_column_hint(ObserverHints::ColumnNoHints),
drag_drop_flags(ObserverHints::NoDragDrop);
category_editing_flags(ObserverHints::CategoriesReadOnly),
category_list(QStringList()),
inverse_categories(true),
category_filter_enabled(false),

Member Function Documentation

void Qtilities::Core::ObserverHints::addDisplayedCategory ( const QtilitiesCategory category)

Adds a displayed category to the list of displayed categories.

See also:
displayedCategories()
Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverHints::exportBinary ( QDataStream &  stream) const
virtual

Allows exporting to a QDataStream.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Parameters:
streamA reference to the QDataStream to which the object's information must be appended is provided.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverHints::exportXml ( QDomDocument *  doc,
QDomElement *  object_node 
) const
virtual

Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverHints::importBinary ( QDataStream &  stream,
QList< QPointer< QObject > > &  import_list 
)
virtual

Allows importing and reconstruction of the object state from information provided in a QDataStream.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Parameters:
streamThe QDataStream which contains the object's information.
import_listAll objects constructed during the import operation must be added to the import list. When the operation fails, all objects in this list will be deleted.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverHints::importXml ( QDomDocument *  doc,
QDomElement *  object_node,
QList< QPointer< QObject > > &  import_list 
)
virtual

Allows importing and reconstruction of data from information provided in a XML document. A reference to the QDomElement which contains the object's information is provided, along with a reference to the QDomDocument.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::InstanceFactoryInfo Qtilities::Core::ObserverHints::instanceFactoryInfo ( ) const
virtual

The instance factory information which must be used when the exported object is reconstructed during an import.

For more information see The IExportable interface, what does it have to do with factories?.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::ObserverHints::ItemSelectionControl Qtilities::Core::ObserverHints::itemSelectionControlHint ( ) const

Gets the selection control hint.

When in tree mode, Qtilities::CoreGui::ObserverWidget uses the selection control hint of the top level observer (root item) and does not inherit the selection control hint of other observer contexts in the tree when they become active which will happen when the user selects objects in those contexts.

void Qtilities::Core::ObserverHints::modificationStateChanged ( bool  is_modified) const
virtualsignal

Implement this function as a signal when implementing the object.

Because this interface does not use the Q_OBJECT macro, you cannot connect to this signal directly. Instead you need to connect to the signal on the base object implementing this interface as follows:

connect(iface->objectBase(),SIGNAL(modificationStateChanged(bool)),SLOT(yourSlot(bool)));

Implements Qtilities::Core::Interfaces::IModificationNotifier.

const QObject* Qtilities::Core::ObserverHints::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.

void Qtilities::Core::ObserverHints::removeDisplayedCategory ( const QtilitiesCategory category)

Removes a displayed category to the list of displayed categories.

See also:
displayedCategories()
ObserverHints::RootIndexDisplayHint ObserverHints::rootIndexDisplayHint ( ) const

Function to get the category editing display hint for this observer's context.

This function was added in Qtilities v1.2.

QString ObserverHints::rootIndexDisplayHintToString ( RootIndexDisplayHint  root_index_display_hint)
static

Function which returns a string associated with a specific RootIndexDisplayHint.

This function was added in Qtilities v1.2.

void Qtilities::Core::ObserverHints::setDisplayedCategories ( const QList< QtilitiesCategory > &  displayed_categories,
bool  inversed = false 
)

Function to set the categories you want to be displayed in item views viewing this observer.

Only applicable when an observer provides a CategorizedHierarchy hierachical display hint. Only categories which appears in the category list will be displayed, or passing true as the inversed paramater will inverse the list. Thus, all categories will be displayed except the categories in the category_list paramater.

Calling this function will automatically update all views viewing the observer.

See also:
setCategoryFilterEnabled()
void ObserverHints::setRootIndexDisplayHint ( ObserverHints::RootIndexDisplayHint  root_index_display_hint)

Function to set the root index display hint for this observer's context.

This function was added in Qtilities v1.2.

ObserverHints::RootIndexDisplayHint ObserverHints::stringToRootIndexDisplayHint ( const QString &  root_index_display_hint_string)
static

Function which returns the RootIndexDisplayHint associated with a string.

This function was added in Qtilities v1.2.

Qtilities::Core::Interfaces::IExportable::ExportModeFlags Qtilities::Core::ObserverHints::supportedFormats ( ) const
virtual

Provides information about the export format(s) supported by your implementation of IExportable.

Note:
It is important to note that you need to check the exportVersion() when you return the supported formats.

Reimplemented from Qtilities::Core::Interfaces::IExportable.



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