Selection In ParaQ: Difference between revisions
From ParaQ Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
* Qt provides a QItemSelectionModel. As per the Trolltech documentation it keeps the indexes for items in a model. The same selection model object can be shared among several views that have use the same underlying model. QItemSelectionModel, generally speaking, keeps a QItemSelection object. QItemSelection can be thought of as a collection QModelIndex objects for the selected enties. These QModelIndex objects depend on the model. Given a QModelIndex, pqPipelineModel knows exactly which pqServerManagerModelItem (and in turn which vtkSMProxy) the index is refering to. | * Qt provides a QItemSelectionModel. As per the Trolltech documentation it keeps the indexes for items in a model. The same selection model object can be shared among several views that have use the same underlying model. QItemSelectionModel, generally speaking, keeps a QItemSelection object. QItemSelection can be thought of as a collection QModelIndex objects for the selected enties. These QModelIndex objects depend on the model. Given a QModelIndex, pqPipelineModel knows exactly which pqServerManagerModelItem (and in turn which vtkSMProxy) the index is refering to. | ||
* pqServerManagerModel keeps a collection of pqServerManagerModelItems which represent source/filter/display proxies. We define a new class | * pqServerManagerModel keeps a collection of pqServerManagerModelItems which represent source/filter/display proxies. We define a new class pqSelection which is a collection of pqServerManagerModelItems. Note pqSelection is not a subclass of QItemSelection nor does it use QModelIndex objects. Thus is due to the fact that QModelIndex use (row, column) to identify the model item, which doesn't apply to the graph model (pqServerManagerModel). Given a pqSelection object, pqServerManagerModel knows exactly what proxies are selected in the selection. | ||
* We define a Selection Adaptor. Given a pqPipelineModel and a QItemSelection for it, the Selection Adaptor generates a pqSelection object. This is quite trivial since it is very easy to obtain a pqServerManagerModelItem, given a pqPipelineModelItem. Additionally, the Selecion Adaptor can convert a pqSelection object to a QItemSelection object for the pqPipelineModel (again, a straight forward task). | * We define a Selection Adaptor. Given a pqPipelineModel and a QItemSelection for it, the Selection Adaptor generates a pqSelection object. This is quite trivial since it is very easy to obtain a pqServerManagerModelItem, given a pqPipelineModelItem. Additionally, the Selecion Adaptor can convert a pqSelection object to a QItemSelection object for the pqPipelineModel (again, a straight forward task). | ||
* Now, when user select elements in the Pipeline Browser, we have a QItemSelection. We take this selection, give it to the Selection Adaptor and obtain a | * Now, when user select elements in the Pipeline Browser, we have a QItemSelection. We take this selection, give it to the Selection Adaptor and obtain a pqSelection. The ServerManager can then be told to select the collection of proxies in pqSelection (once the selection mechanism is added to the Server Manager). | ||
* Similarly when the user does a rubber band select in the render window, the Server Manager will create a collection of selection proxies. pqServerManagerModel can build a | * Similarly when the user does a rubber band select in the render window, the Server Manager will create a collection of selection proxies. pqServerManagerModel can build a pqSelection out of this collection of vtkSMProxies. The Selection Adaptor can translate pqSelection to QItemSelection suitable for any view on pqPipelineModel. |
Revision as of 16:31, 6 June 2006
This documents discusses a design for Selection in ParaQ.
Background
- pqServerManagerModel -- graph model for the vtkSMProxyManager state.
- pqPipelineModel -- tree model generated using pqServerManagerModel. This is QAbstractItemModel subclass.
Design
- Qt provides a QItemSelectionModel. As per the Trolltech documentation it keeps the indexes for items in a model. The same selection model object can be shared among several views that have use the same underlying model. QItemSelectionModel, generally speaking, keeps a QItemSelection object. QItemSelection can be thought of as a collection QModelIndex objects for the selected enties. These QModelIndex objects depend on the model. Given a QModelIndex, pqPipelineModel knows exactly which pqServerManagerModelItem (and in turn which vtkSMProxy) the index is refering to.
- pqServerManagerModel keeps a collection of pqServerManagerModelItems which represent source/filter/display proxies. We define a new class pqSelection which is a collection of pqServerManagerModelItems. Note pqSelection is not a subclass of QItemSelection nor does it use QModelIndex objects. Thus is due to the fact that QModelIndex use (row, column) to identify the model item, which doesn't apply to the graph model (pqServerManagerModel). Given a pqSelection object, pqServerManagerModel knows exactly what proxies are selected in the selection.
- We define a Selection Adaptor. Given a pqPipelineModel and a QItemSelection for it, the Selection Adaptor generates a pqSelection object. This is quite trivial since it is very easy to obtain a pqServerManagerModelItem, given a pqPipelineModelItem. Additionally, the Selecion Adaptor can convert a pqSelection object to a QItemSelection object for the pqPipelineModel (again, a straight forward task).
- Now, when user select elements in the Pipeline Browser, we have a QItemSelection. We take this selection, give it to the Selection Adaptor and obtain a pqSelection. The ServerManager can then be told to select the collection of proxies in pqSelection (once the selection mechanism is added to the Server Manager).
- Similarly when the user does a rubber band select in the render window, the Server Manager will create a collection of selection proxies. pqServerManagerModel can build a pqSelection out of this collection of vtkSMProxies. The Selection Adaptor can translate pqSelection to QItemSelection suitable for any view on pqPipelineModel.