ItemPtr item = myModel ? myModel->createItem( obj, parent, after ) : 0;
// Additional actions that can't be performed by the model, e.g. expanded state
- if( item && myModel->updater() )
- myModel->updater()->update( obj );
+ if( item )
+ obj->update();
return item;
}
*/
void SUIT_TreeModel::TreeSync::updateItem( const ObjPtr& obj, const ItemPtr& item ) const
{
+ if( obj )
+ obj->update();
if ( item && needUpdate( item ) )
myModel->updateItem( item );
-
- // SUIT_TreeUpdater class performs additional update of a tree view,
- // since the view is not available from inside a model
- if( obj && myModel->updater() )
- myModel->updater()->update( obj );
}
/*!
myRoot( 0 ),
myRootItem( 0 ),
myAutoDeleteTree( false ),
- myAutoUpdate( true ),
- myUpdater( 0 )
+ myAutoUpdate( true )
{
initialize();
}
myRoot( root ),
myRootItem( 0 ),
myAutoDeleteTree( false ),
- myAutoUpdate( true ),
- myUpdater( 0 )
+ myAutoUpdate( true )
{
initialize();
}
delete myRoot;
}
- delete myUpdater;
delete myRootItem;
}
}
}
-/*!
- \brief Get tree updater.
- \return current tree updater or 0 if it is not set
-*/
-SUIT_TreeUpdater* SUIT_TreeModel::updater() const
-{
- return myUpdater;
-}
-
-/*!
- \brief Set tree updater.
- \param upd new tree updater
-*/
-void SUIT_TreeModel::setUpdater( SUIT_TreeUpdater* upd )
-{
- if ( myUpdater )
- delete myUpdater;
-
- myUpdater = upd;
-
- updateTree();
-}
/*!
\brief Check if the specified column supports custom sorting.
int row = item->position();
beginRemoveRows( parentIdx, row, row );
-
myItems.remove( obj );
- endRemoveRows();
-
if ( obj == root() )
setRoot( 0 );
else if ( item->parent() )
item->parent()->removeChild( item );
delete item;
+
+ endRemoveRows();
}
/*!
treeModel()->setAutoUpdate( on );
}
-/*!
- \brief Get tree updater.
- \return current tree updater or 0 if it is not set
-*/
-SUIT_TreeUpdater* SUIT_ProxyModel::updater() const
-{
- return treeModel() ? treeModel()->updater() : 0;
-}
-
-/*!
- \brief Set tree updater.
- \param upd new tree updater
-*/
-void SUIT_ProxyModel::setUpdater( SUIT_TreeUpdater* upd )
-{
- if ( treeModel() )
- treeModel()->setUpdater( upd );
-}
-
/*!
\brief Check if sorting is enabled.
\return \c true if sorting is enabled
class SUIT_DataObject;
class SUIT_TreeModel;
-class SUIT_EXPORT SUIT_TreeUpdater
-{
-public:
- SUIT_TreeUpdater( SUIT_TreeModel* ) {};
- virtual ~SUIT_TreeUpdater() {};
- virtual void update( SUIT_DataObject* theObj ) = 0;
-};
-
class SUIT_EXPORT SUIT_TreeModel : public QAbstractItemModel
{
Q_OBJECT
bool autoUpdate() const;
void setAutoUpdate( const bool );
- SUIT_TreeUpdater* updater() const;
- void setUpdater( SUIT_TreeUpdater* );
-
virtual bool customSorting( const int ) const;
virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
ItemMap myItems;
bool myAutoDeleteTree;
bool myAutoUpdate;
- SUIT_TreeUpdater* myUpdater;
friend class SUIT_TreeModel::TreeSync;
};
bool autoUpdate() const;
void setAutoUpdate( const bool );
-
- SUIT_TreeUpdater* updater() const;
- void setUpdater( SUIT_TreeUpdater* );
-
+
bool isSortingEnabled() const;
QAbstractItemDelegate* delegate() const;