
Originally Posted by
PrimeCP
How would I differentiate in the model between the 2 views?
You will have two models --- original one and a proxy model.
{
Q_OBJECT
public:
...
virtual Qt
::ItemFlags flags
( const QModelIndex & index
) const {
if( _checkingDisabled ) {
f &= ~ Qt::ItemIsUserCheckable;
}
return f;
}
...
};
...
ProxyModel * proxyModel = new ProxyModel();
proxyModel->setSourceModel( originalModel );
firstView->setModel( originalModel );
secondView->setModel( proxyModel );
class ProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
...
virtual Qt::ItemFlags flags( const QModelIndex & index ) const
{
Qt::ItemFlags f = QSortFilterProxyModel::flags( index );
if( _checkingDisabled ) {
f &= ~ Qt::ItemIsUserCheckable;
}
return f;
}
...
};
...
ProxyModel * proxyModel = new ProxyModel();
proxyModel->setSourceModel( originalModel );
firstView->setModel( originalModel );
secondView->setModel( proxyModel );
To copy to clipboard, switch view to plain text mode
Bookmarks