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

The ObserverTableModel class provides an ready-to-use model that can be used to show the contents of an Qtilities::Core::Observer in a QTableView. More...

#include <ObserverTableModel.h>

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

List of all members.

Signals

void layoutChangeCompleted ()
 Signal which is emitted after the layoutChanged() signal was emitted.
void moreDataFetched (int number)
 Signal which is emitted when more data is fetched from the model.
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 grouped activity changes completed.

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 getIndex (QObject *obj, int column=-1) const
 Convenience function to get the QModelIndex of an object in the table.
QObject * getObject (const QModelIndex &index) const
 Abstract function which must be implemented to get the object at the given index.
QObject * getObject (int row) const
 Convenience function to get the QObject at a specific row.
int getSubjectID (const QModelIndex &index) const
 Abstract function which must be implemented to get the subject ID of the object at the given index.
int getSubjectID (int row) const
 Convenience function to get the subject ID of a QObject at a specific row.
void refresh ()
 Forces this model to refresh its layout.
virtual bool setObserverContext (Observer *observer)
 Implement the virtual function to get references to known filters.
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.
- Public Member Functions inherited from Qtilities::CoreGui::AbstractObserverItemModel
ObserverHintsactiveHints () 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 readOnly () const
 Gets if this model must be read only, thus its actions and property editor will be read only.
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.
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 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.
- Public Member Functions inherited from Qtilities::Core::ObserverAwareBase
ObserverobserverContext () const
 Gets a pointer to the observer context.

Additional Inherited Members

- Public Types inherited from Qtilities::CoreGui::AbstractObserverItemModel
enum  ColumnID
 The possible columns which can be requested by views for an module.

Detailed Description

The ObserverTableModel class provides an ready-to-use model that can be used to show the contents of an Qtilities::Core::Observer in a QTableView.

The ObserverTableModel class provides an ready-to-use model that can be used to show and manage the contents of an Qtilities::Core::Observer in a QTableView.

To view the contents of an Observer, use the setObserverContext function. This function will initialize the model and show the names of subjects attached to a specific observer in a QTableView. ObserverTableModel 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:
ObserverTreeModel

Member Function Documentation

int Qtilities::CoreGui::ObserverTableModel::columnPosition ( AbstractObserverItemModel::ColumnID  column_id) const
virtual

The model implementation must return the index (starting at 0) for the requested column.

Note:
If your model does not support a specific column, return -1.
ColumnLast must return the number of columns you use in your model.

Implements Qtilities::CoreGui::AbstractObserverItemModel.

QModelIndex Qtilities::CoreGui::ObserverTableModel::getIndex ( QObject *  obj,
int  column = -1 
) const

Convenience function to get the QModelIndex of an object in the table.

Parameters:
objThe object to find.
columnThe colum requested.
Returns:
The QModelIndex of the specified object. If the object was not found QModelIndex() is returned.
QObject * Qtilities::CoreGui::ObserverTableModel::getObject ( int  row) const

Convenience function to get the QObject at a specific row.

Returns:
The the object at the specified row. If the row is invalid, 0 is returned.
int Qtilities::CoreGui::ObserverTableModel::getSubjectID ( int  row) const

Convenience function to get the subject ID of a QObject at a specific row.

Returns:
The the subject ID of the object at the specified row. If the row is invalid, -1 is returned.
void Qtilities::CoreGui::ObserverTableModel::moreDataFetched ( int  number)
signal

Signal which is emitted when more data is fetched from the model.

Parameters:
numberThe number of items fetched.
void Qtilities::CoreGui::ObserverTableModel::refresh ( )
virtual

Forces this model to refresh its layout.

This function was added in Qtilities v1.1.

Implements Qtilities::CoreGui::AbstractObserverItemModel.

void Qtilities::CoreGui::ObserverTableModel::setSelectedObjects ( QList< QPointer< QObject > >  selected_objects)

Function to let the model know which objects are currently selected in the view connected to this model.

This functionality is used in order to allow group activity changes on selected items if the observer context shown contains an ActivityPolicyFilter that supports these type of operations.

This function was added in Qtilities v1.2.



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