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>
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 | |
ObserverHints * | activeHints () const |
This function will provide the hints which should be used by this model at any time. | |
QString | columnChildCountBaseClass () const |
Gets the base class to use for tree count operations in the ColumnChildCount column if shown. | |
int | columnChildCountLimit () const |
Gets the upper limit to use for tree count operations in the ColumnChildCount column if shown. | |
bool | lazyInitEnabled () const |
Gets if lazy initialization is enabled. | |
bool | 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 | |
Observer * | observerContext () 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. |
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.
|
virtual |
The model implementation must return the index (starting at 0) for the requested column.
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.
obj | The object to find. |
column | The colum requested. |
QObject * Qtilities::CoreGui::ObserverTableModel::getObject | ( | int | row | ) | const |
Convenience function to get the QObject at a specific row.
int Qtilities::CoreGui::ObserverTableModel::getSubjectID | ( | int | row | ) | const |
Convenience function to get the subject ID of a QObject at a specific row.
|
signal |
Signal which is emitted when more data is fetched from the model.
number | The number of items fetched. |
|
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é
|