Proxy model which can be used above the SUIT_TreeMovel class to enable custom sorting/filtering of the data. More...
#include <SUIT_TreeModel.h>

Public Slots | |
| virtual void | updateTree (const QModelIndex &) |
| Update tree model. | |
| virtual void | updateTree (SUIT_DataObject *=0) |
| Update tree model. | |
| void | setSortingEnabled (bool) |
| Enable/disable sorting. | |
Signals | |
| void | modelUpdated () |
| void | clicked (SUIT_DataObject *, int) |
Public Member Functions | |
| SUIT_ProxyModel (QObject *=0) | |
| Constructor. | |
| SUIT_ProxyModel (SUIT_DataObject *, QObject *=0) | |
| Constructor. | |
| SUIT_ProxyModel (SUIT_AbstractModel *, QObject *=0) | |
| Constructor. | |
| ~SUIT_ProxyModel () | |
| Destructor. | |
| SUIT_DataObject * | root () const |
| Get data tree root object. | |
| void | setRoot (SUIT_DataObject *) |
| Set data tree root object. | |
| SUIT_DataObject * | object (const QModelIndex &=QModelIndex()) const |
| Get data object by the specified model index. | |
| QModelIndex | index (const SUIT_DataObject *, int=0) const |
| Get model index by the specified data object. | |
| bool | autoDeleteTree () const |
| Get 'auto-delete data tree' flag value. | |
| void | setAutoDeleteTree (const bool) |
| Set 'auto-delete data tree' flag value. | |
| bool | autoUpdate () const |
| Get 'auto-update tree' flag value. | |
| void | setAutoUpdate (const bool) |
| Set 'auto-update tree' flag value. | |
| bool | updateModified () const |
| Get 'updateModified' flag value. | |
| void | setUpdateModified (const bool) |
| Set 'updateModified' flag value. | |
| bool | isSortingEnabled () const |
| Check if sorting is enabled. | |
| bool | customSorting (const int) const |
| Check if the specified column supports custom sorting. | |
| virtual bool | lessThan (const QModelIndex &, const QModelIndex &) const |
| Compares two model indexes for the sorting purposes. | |
| virtual void | registerColumn (const int group_id, const QString &name, const int custom_id) |
| Register new column in the model. | |
| virtual void | unregisterColumn (const int group_id, const QString &name) |
| Remove column from the model. | |
| virtual void | setColumnIcon (const QString &name, const QPixmap &icon) |
| Change column icon. | |
| virtual QPixmap | columnIcon (const QString &name) const |
| Get column icon. | |
| virtual void | setAppropriate (const QString &name, const Qtx::Appropriate appr) |
| Change appropriate status. | |
| virtual Qtx::Appropriate | appropriate (const QString &name) const |
| Check if the column should appear in the tree view header popup menu (to show/hide the column). | |
| virtual void | setVisibilityState (const QString &id, Qtx::VisibilityState state) |
| Set visibility state of the object. | |
| virtual void | setVisibilityStateForAll (Qtx::VisibilityState state) |
| Set visibility state for all objects. | |
| virtual Qtx::VisibilityState | visibilityState (const QString &id) const |
| Get visibility state of the object. | |
| virtual void | setHeaderFlags (const QString &name, const Qtx::HeaderViewFlags flags) |
| Set header flags. | |
| virtual Qtx::HeaderViewFlags | headerFlags (const QString &name) const |
| Get the header flags. | |
| virtual void | emitClicked (SUIT_DataObject *obj, const QModelIndex &index) |
| virtual SUIT_DataSearcher * | searcher () const |
| virtual void | setSearcher (SUIT_DataSearcher *) |
| QAbstractItemDelegate * | delegate () const |
| Get item delegate for the model. | |
| operator const QAbstractItemModel * () const | |
| operator QAbstractItemModel * () | |
| operator const QObject * () const | |
Protected Member Functions | |
| SUIT_AbstractModel * | treeModel () const |
| virtual bool | filterAcceptsRow (int, const QModelIndex &) const |
| Filter rows. | |
Private Attributes | |
| bool | mySortingEnabled |
The SUIT_TreeModel class does not support custom sorting/filtering of the data. To use these features, the SUIT_ProxyModel class can be used as top-level wrapper for the SUIT_DataObject-based data tree model.
| SUIT_ProxyModel::SUIT_ProxyModel | ( | QObject * | parent = 0 | ) |
| parent | parent object |
References clicked(), and modelUpdated().
| SUIT_ProxyModel::SUIT_ProxyModel | ( | SUIT_DataObject * | root, |
| QObject * | parent = 0 |
||
| ) |
| root | root data object |
| parent | parent object |
References clicked(), and modelUpdated().
| SUIT_ProxyModel::SUIT_ProxyModel | ( | SUIT_AbstractModel * | model, |
| QObject * | parent = 0 |
||
| ) |
| model | tree model |
| parent | parent object |
References clicked(), and modelUpdated().
| SUIT_ProxyModel::~SUIT_ProxyModel | ( | ) |
| SUIT_DataObject * SUIT_ProxyModel::root | ( | ) | const [virtual] |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.root(), and treeModel().
| void SUIT_ProxyModel::setRoot | ( | SUIT_DataObject * | r | ) | [virtual] |
| r | new data tree root |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setRoot(), and treeModel().
| SUIT_DataObject * SUIT_ProxyModel::object | ( | const QModelIndex & | index = QModelIndex() | ) | const [virtual] |
| index | model index |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.object(), and treeModel().
| QModelIndex SUIT_ProxyModel::index | ( | const SUIT_DataObject * | obj, |
| int | column = 0 |
||
| ) | const [virtual] |
| obj | data object |
| column | data object column |
Implements SUIT_AbstractModel.
References treeModel().
| bool SUIT_ProxyModel::autoDeleteTree | ( | ) | const [virtual] |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.autoDeleteTree(), and treeModel().
| void SUIT_ProxyModel::setAutoDeleteTree | ( | const bool | on | ) | [virtual] |
If this flag is set to true, the data tree is deleted when the tree model is destroyed. Default value for this flag is false.
| on | 'auto-delete data tree' flag value |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setAutoDeleteTree(), and treeModel().
| bool SUIT_ProxyModel::autoUpdate | ( | ) | const [virtual] |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.autoUpdate(), and treeModel().
| void SUIT_ProxyModel::setAutoUpdate | ( | const bool | on | ) | [virtual] |
If this flag is set to true (by default), the model is updated automatically when data tree is changed.
| on | 'auto-update tree' flag value |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setAutoUpdate(), and treeModel().
| bool SUIT_ProxyModel::updateModified | ( | ) | const [virtual] |
Implements SUIT_AbstractModel.
References treeModel(), and SUIT_AbstractModel.updateModified().
| void SUIT_ProxyModel::setUpdateModified | ( | const bool | on | ) | [virtual] |
If this flag is set to true (default=false), the model is updated by updateTreeModel that uses the isModified flag to update only modified objects
| on | 'updateModified' flag value |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setUpdateModified(), and treeModel().
| bool SUIT_ProxyModel::isSortingEnabled | ( | ) | const |
| bool SUIT_ProxyModel::customSorting | ( | const int | column | ) | const [virtual] |
| column | column index on which data is being sorted |
true if column requires custom sorting Implements SUIT_AbstractModel.
References SUIT_AbstractModel.customSorting(), and treeModel().
| bool SUIT_ProxyModel::lessThan | ( | const QModelIndex & | left, |
| const QModelIndex & | right | ||
| ) | const [virtual] |
| left | first index to compare |
| right | second index to compare |
Implements SUIT_AbstractModel.
References customSorting(), isSortingEnabled(), SUIT_AbstractModel.lessThan(), and treeModel().
| void SUIT_ProxyModel::registerColumn | ( | const int | group_id, |
| const QString & | name, | ||
| const int | custom_id | ||
| ) | [virtual] |
| group_id | - unique data object identificator allowing the classification of objects |
| name | - translated column name |
| custom_id | - custom column id that should be passed into method SUIT_DataObject.data() |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.registerColumn(), and treeModel().
| void SUIT_ProxyModel::unregisterColumn | ( | const int | group_id, |
| const QString & | name | ||
| ) | [virtual] |
Please take into account that column is removed only for given group_id, it means that information of data objects with such group_id won't be shown. If there is not any registered group_id for this column after removing, the column will be hidden otherwise it continue to be shown
| group_id | - unique data object identificator allowing the classification of objects |
| name | - translated column name |
Implements SUIT_AbstractModel.
References treeModel(), and SUIT_AbstractModel.unregisterColumn().
| void SUIT_ProxyModel::setColumnIcon | ( | const QString & | name, |
| const QPixmap & | icon | ||
| ) | [virtual] |
| name | - column name |
| icon | - new icon of the specified column |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setColumnIcon(), and treeModel().
| QPixmap SUIT_ProxyModel::columnIcon | ( | const QString & | name | ) | const [virtual] |
| name | - column name |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.columnIcon(), and treeModel().
| void SUIT_ProxyModel::setAppropriate | ( | const QString & | name, |
| const Qtx::Appropriate | appr | ||
| ) | [virtual] |
Appropriate status determines if the column should appear in the tree view header popup menu (to show/hide the column).
If appropriate status is not specified yet, the Shown value is taken, it means that column should be always visible.
| name | - column name |
| appr | - new appropriate status |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setAppropriate(), and treeModel().
| Qtx::Appropriate SUIT_ProxyModel::appropriate | ( | const QString & | name | ) | const [virtual] |
Default implementation (if appropriate status is not specified yet) returns Shown, it means that column should be always visible.
| name | - column name |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.appropriate(), Qtx.Shown, and treeModel().
| void SUIT_ProxyModel::setVisibilityState | ( | const QString & | id, |
| Qtx::VisibilityState | state | ||
| ) | [virtual] |
| id | - column name |
| state | - visible state |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setVisibilityState(), and treeModel().
| void SUIT_ProxyModel::setVisibilityStateForAll | ( | Qtx::VisibilityState | state | ) | [virtual] |
| id | - column name |
| state | - visible state |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setVisibilityStateForAll(), and treeModel().
| Qtx::VisibilityState SUIT_ProxyModel::visibilityState | ( | const QString & | id | ) | const [virtual] |
| id | - column name |
Implements SUIT_AbstractModel.
References treeModel(), Qtx.UnpresentableState, and SUIT_AbstractModel.visibilityState().
| void SUIT_ProxyModel::setHeaderFlags | ( | const QString & | name, |
| const Qtx::HeaderViewFlags | flags | ||
| ) | [virtual] |
These flags allow show in the header of the column text (name of the column), icon or both text and icon.
| name | - column name |
| flags | - header flags |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.setHeaderFlags(), and treeModel().
| Qtx::HeaderViewFlags SUIT_ProxyModel::headerFlags | ( | const QString & | name | ) | const [virtual] |
These flags allow show in the header of the column text (name of the column), icon or both text and icon.
| name | - column name |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.headerFlags(), Qtx.ShowAll, and treeModel().
| void SUIT_ProxyModel::emitClicked | ( | SUIT_DataObject * | obj, |
| const QModelIndex & | index | ||
| ) | [virtual] |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.emitClicked(), and treeModel().
| SUIT_DataSearcher * SUIT_ProxyModel::searcher | ( | ) | const [virtual] |
Reimplemented from SUIT_AbstractModel.
References SUIT_AbstractModel.searcher(), and treeModel().
| void SUIT_ProxyModel::setSearcher | ( | SUIT_DataSearcher * | s | ) | [virtual] |
Reimplemented from SUIT_AbstractModel.
References SUIT_AbstractModel.setSearcher(), and treeModel().
| QAbstractItemDelegate * SUIT_ProxyModel::delegate | ( | ) | const [virtual] |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel.delegate(), and treeModel().
| void SUIT_ProxyModel::updateTree | ( | const QModelIndex & | index | ) | [virtual, slot] |
Call this method when data tree is changed outside the model. If the 'auto-update' flag is set to true, the model is updated automatically when the data tree is changed.
| index | starting index for the updating |
Implements SUIT_AbstractModel.
References treeModel(), and SUIT_AbstractModel.updateTree().
| void SUIT_ProxyModel::updateTree | ( | SUIT_DataObject * | obj = 0 | ) | [virtual, slot] |
Call this method when data tree is changed outside the model. If the 'auto-update' flag is set to true, the model is updated automatically when the data tree is changed.
| obj | starting data object for the updating |
Implements SUIT_AbstractModel.
References treeModel(), and SUIT_AbstractModel.updateTree().
| void SUIT_ProxyModel::setSortingEnabled | ( | bool | enabled | ) | [slot] |
| void SUIT_ProxyModel.modelUpdated | ( | ) | [signal] |
| void SUIT_ProxyModel.clicked | ( | SUIT_DataObject * | , |
| int | |||
| ) | [signal] |
| SUIT_AbstractModel * SUIT_ProxyModel::treeModel | ( | ) | const [protected] |
| bool SUIT_ProxyModel::filterAcceptsRow | ( | int | sourceRow, |
| const QModelIndex & | sourceParent | ||
| ) | const [protected, virtual] |
| sourceRow | row index of the source data model |
| sourceParent | parent model index of the source data model |
true if the specified row should be filtered out (i.e. not displayed) or false otherwise References SUIT_DataObject.expandable(), index(), SUIT_DataObject.isVisible(), SUIT_AbstractModel.object(), SUIT_DataObject.parent(), and treeModel().
| SUIT_AbstractModel::operator const QAbstractItemModel * | ( | ) | const [inherited] |
| SUIT_AbstractModel::operator QAbstractItemModel * | ( | ) | [inherited] |
| SUIT_AbstractModel::operator const QObject * | ( | ) | const [inherited] |
bool SUIT_ProxyModel.mySortingEnabled [private] |