Proxy model which can be used above the SUIT_TreeModel class to enable custom sorting/filtering of the data. More...
#include <SUIT_TreeModel.h>
Public Slots | |
virtual void | updateTree (const QModelIndex &) |
Update tree model. More... | |
virtual void | updateTree (SUIT_DataObject *=0) |
Update tree model. More... | |
void | setSortingEnabled (bool) |
Enable/disable sorting. More... | |
Signals | |
void | modelUpdated () |
void | clicked (SUIT_DataObject *, int) |
void | dropped (const QList< SUIT_DataObject * > &, SUIT_DataObject *, int, Qt::DropAction) |
void | renamed (SUIT_DataObject *) |
Public Member Functions | |
SUIT_ProxyModel (QObject *=0) | |
Constructor. More... | |
SUIT_ProxyModel (SUIT_DataObject *, QObject *=0) | |
Constructor. More... | |
SUIT_ProxyModel (SUIT_AbstractModel *, QObject *=0) | |
Constructor. More... | |
~SUIT_ProxyModel () | |
Destructor. More... | |
SUIT_DataObject * | root () const |
Get data tree root object. More... | |
void | setRoot (SUIT_DataObject *) |
Set data tree root object. More... | |
SUIT_DataObject * | object (const QModelIndex &=QModelIndex()) const |
Get data object by the specified model index. More... | |
QModelIndex | index (const SUIT_DataObject *, int=0) const |
Get model index by the specified data object. More... | |
bool | autoDeleteTree () const |
Get 'auto-delete data tree' flag value. More... | |
void | setAutoDeleteTree (const bool) |
Set 'auto-delete data tree' flag value. More... | |
bool | autoUpdate () const |
Get 'auto-update tree' flag value. More... | |
void | setAutoUpdate (const bool) |
Set 'auto-update tree' flag value. More... | |
bool | updateModified () const |
Get 'updateModified' flag value. More... | |
void | setUpdateModified (const bool) |
Set 'updateModified' flag value. More... | |
bool | isSortingEnabled () const |
Check if sorting is enabled. More... | |
bool | customSorting (const int) const |
Check if the specified column supports custom sorting. More... | |
virtual void | forgetObject (const SUIT_DataObject *) |
virtual bool | lessThan (const QModelIndex &, const QModelIndex &) const |
Compares two model indexes for the sorting purposes. More... | |
virtual void | registerColumn (const int group_id, const QString &name, const int custom_id) |
Register new column in the model. More... | |
virtual void | unregisterColumn (const int group_id, const QString &name) |
Remove column from the model. More... | |
virtual void | setColumnIcon (const QString &name, const QPixmap &icon) |
Change column icon. More... | |
virtual QPixmap | columnIcon (const QString &name) const |
Get column icon. More... | |
virtual void | setAppropriate (const QString &name, const Qtx::Appropriate appr) |
Change appropriate status. More... | |
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). More... | |
virtual void | setVisibilityState (const QString &id, Qtx::VisibilityState state, bool emitChanged=true) |
Set visibility state of the object. More... | |
virtual void | setVisibilityStateForAll (Qtx::VisibilityState state) |
Set visibility state for all objects. More... | |
virtual Qtx::VisibilityState | visibilityState (const QString &id) const |
Get visibility state of the object. More... | |
virtual void | setHeaderFlags (const QString &name, const Qtx::HeaderViewFlags flags) |
Set header flags. More... | |
virtual Qtx::HeaderViewFlags | headerFlags (const QString &name) const |
Get the header flags. More... | |
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. More... | |
Public Member Functions inherited from SUIT_AbstractModel | |
SUIT_AbstractModel () | |
operator const QAbstractItemModel * () const | |
operator QAbstractItemModel * () | |
operator const QObject * () const | |
virtual void | updateTree (const QModelIndex &)=0 |
virtual void | updateTree (SUIT_DataObject *=0)=0 |
Protected Member Functions | |
SUIT_AbstractModel * | treeModel () const |
virtual bool | filterAcceptsRow (int, const QModelIndex &) const |
Filter rows. More... | |
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(), dropped(), modelUpdated(), and renamed().
SUIT_ProxyModel::SUIT_ProxyModel | ( | SUIT_DataObject * | root, |
QObject * | parent = 0 |
||
) |
root | root data object |
parent | parent object |
References clicked(), dropped(), modelUpdated(), and renamed().
SUIT_ProxyModel::SUIT_ProxyModel | ( | SUIT_AbstractModel * | model, |
QObject * | parent = 0 |
||
) |
model | tree model |
parent | parent object |
References clicked(), dropped(), modelUpdated(), and renamed().
SUIT_ProxyModel::~SUIT_ProxyModel | ( | ) |
|
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().
|
virtual |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::autoDeleteTree(), and treeModel().
|
virtual |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::autoUpdate(), and treeModel().
|
signal |
|
virtual |
name | - column name |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::columnIcon(), and treeModel().
|
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().
|
virtual |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::delegate(), and treeModel().
|
signal |
|
virtual |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::emitClicked(), and treeModel().
|
protectedvirtual |
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().
|
virtual |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::forgetObject(), and treeModel().
|
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().
|
virtual |
obj | data object |
column | data object column |
Implements SUIT_AbstractModel.
References treeModel().
bool SUIT_ProxyModel::isSortingEnabled | ( | ) | const |
|
virtual |
left | first index to compare |
right | second index to compare |
Implements SUIT_AbstractModel.
References customSorting(), isSortingEnabled(), SUIT_AbstractModel::lessThan(), and treeModel().
|
signal |
|
virtual |
index | model index |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::object(), and treeModel().
|
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().
|
signal |
|
virtual |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::root(), and treeModel().
|
virtual |
Reimplemented from SUIT_AbstractModel.
References SUIT_AbstractModel::searcher(), and treeModel().
|
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().
|
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().
|
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().
name | - column name |
icon | - new icon of the specified column |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::setColumnIcon(), and treeModel().
|
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().
|
virtual |
r | new data tree root |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::setRoot(), and treeModel().
|
virtual |
Reimplemented from SUIT_AbstractModel.
References SUIT_AbstractModel::setSearcher(), and treeModel().
|
slot |
|
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().
|
virtual |
id | - column name |
state | - visible state |
emitChanged | - if set to false, blocks dataChanged() signal, this can be used to prevent emitting dataChanged() several times for the same data object |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::setVisibilityState(), and treeModel().
|
virtual |
id | - column name |
state | - visible state |
Implements SUIT_AbstractModel.
References SUIT_AbstractModel::setVisibilityStateForAll(), and treeModel().
|
protected |
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().
|
virtual |
Implements SUIT_AbstractModel.
References treeModel(), and SUIT_AbstractModel::updateModified().
|
virtualslot |
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 |
References treeModel(), and SUIT_AbstractModel::updateTree().
|
virtualslot |
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 |
References treeModel(), and SUIT_AbstractModel::updateTree().
|
virtual |
id | - column name |
Implements SUIT_AbstractModel.
References treeModel(), Qtx::UnpresentableState, and SUIT_AbstractModel::visibilityState().
|
private |