|
SHAPER
9.15.0
|
This is a data model for Object Browser (QTreeView). More...

Signals | |
| void | beforeTreeRebuild () |
| Signal send before tree rebuild. More... | |
| void | treeRebuilt () |
| Signal about tree had been rebuilt. More... | |
Public Member Functions | |
| XGUI_DataModel (QObject *theParent) | |
| Constructor. More... | |
| virtual | ~XGUI_DataModel () |
| Destructor. More... | |
| void | setRoot (ModuleBase_ITreeNode *theRoot) |
| ModuleBase_ITreeNode * | root () const |
| virtual void | processEvent (const std::shared_ptr< Events_Message > &theMessage) |
| Event Listener method. More... | |
| virtual ObjectPtr | object (const QModelIndex &theIndex) const |
| Returns an object by the given Model index. More... | |
| virtual QModelIndex | objectIndex (const ObjectPtr theObject, int theColumn=1) const |
| Returns index of the object. More... | |
| virtual void | clear () |
| Clear internal data. More... | |
| virtual void | rebuildDataTree () |
| Rebuild data tree. More... | |
| virtual QVariant | data (const QModelIndex &theIndex, int theRole) const |
| Returns the data stored under the given role for the item referred to by the index. More... | |
| virtual QVariant | headerData (int theSection, Qt::Orientation theOrient, int theRole=Qt::DisplayRole) const |
| Returns the data for the given role and section in the header with the specified orientation. More... | |
| virtual int | rowCount (const QModelIndex &theParent=QModelIndex()) const |
| Returns the number of rows under the given parent. More... | |
| virtual int | columnCount (const QModelIndex &theParent=QModelIndex()) const |
| Returns the number of columns for the children of the given parent. More... | |
| virtual QModelIndex | index (int theRow, int theColumn, const QModelIndex &theParent=QModelIndex()) const |
| Returns the index of the item in the model specified by the given row, column and parent index. More... | |
| virtual QModelIndex | parent (const QModelIndex &theIndex) const |
| Returns the parent of the model item with the given index. More... | |
| virtual bool | hasChildren (const QModelIndex &theParent=QModelIndex()) const |
| Returns true if parent has any children; otherwise returns false. More... | |
| virtual bool | insertRows (int theRow, int theCount, const QModelIndex &theParent=QModelIndex()) |
| Inserts count rows into the model before the given row. More... | |
| virtual bool | removeRows (int theRow, int theCount, const QModelIndex &theParent=QModelIndex()) |
| Removes count rows starting with the given row under parent parent from the model. More... | |
| virtual Qt::ItemFlags | flags (const QModelIndex &theIndex) const |
| Returns the item flags for the given index. More... | |
| virtual bool | canDropMimeData (const QMimeData *theData, Qt::DropAction theAction, int theRow, int theColumn, const QModelIndex &theParent) const override |
| Returns true if a model can accept a drop of the data (used for drag and drop functionality). More... | |
| virtual QMimeData * | mimeData (const QModelIndexList &indexes) const override |
| Converts the dragged items information into mime data format (to be encoded in dropMimeData) More... | |
| virtual bool | dropMimeData (const QMimeData *theData, Qt::DropAction theAction, int theRow, int theColumn, const QModelIndex &theParent) override |
| Performs a drag and drop of Part feature operation when it is dropped. More... | |
| QModelIndex | documentRootIndex (DocumentPtr theDoc, int theColumn=1) const |
| Returns an index which is root of the given document. More... | |
| bool | hasHiddenState (const QModelIndex &theIndex) |
| Returns true if the data model item has Hidden visual state. More... | |
| bool | hasIndex (const QModelIndex &theIndex) const |
| Returns true if the given index exists in data tree. More... | |
| bool | hasNode (ModuleBase_ITreeNode *theNode) const |
| Returns true if the given node is a parto of the data tree. More... | |
| DocumentPtr | document (const QModelIndex &theIndex) const |
| Returns document of the given index. More... | |
| QModelIndex | getIndex (ModuleBase_ITreeNode *theNode, int thCol) const |
| Returns index for the node and column. More... | |
| virtual Qt::DropActions | supportedDropActions () const override |
| Allows to support drag and drop of some model items. More... | |
| virtual EVENTS_EXPORT bool | groupMessages () |
| Listener that needs mostly grouped messages received returns true in this method. More... | |
Protected Member Functions | |
| void | groupWhileFlush (const std::shared_ptr< Events_Message > &theMessage) |
| Allows to group messages while they are flushed (for flush for groupMessages=true listeners) More... | |
| EVENTS_EXPORT void | flushGrouped (const Events_ID &theID) |
| Sends myGroups on flush finish. More... | |
This is a data model for Object Browser (QTreeView).
It uses XML file for definition of data tree. Some tips about organization of the model:
| XGUI_DataModel::XGUI_DataModel | ( | QObject * | theParent | ) |
Constructor.
| theParent | a parent object |
|
virtual |
Destructor.
|
virtual |
|
virtual |
Returns an object by the given Model index.
Returns 0 if the given index is not index of an object
|
virtual |
Returns index of the object.
| theObject | object to find |
|
virtual |
Clear internal data.
|
virtual |
Rebuild data tree.
|
virtual |
Returns the data stored under the given role for the item referred to by the index.
| theIndex | a model index |
| theRole | a data role (see Qt::ItemDataRole) |
|
virtual |
Returns the data for the given role and section in the header with the specified orientation.
| theSection | a section |
| theOrient | an orientation |
| theRole | a data role (see Qt::ItemDataRole) |
|
virtual |
Returns the number of rows under the given parent.
When the parent is valid it means that rowCount is returning the number of children of parent.
| theParent | a parent model index |
|
virtual |
Returns the number of columns for the children of the given parent.
It has a one column
| theParent | a parent model index |
|
virtual |
Returns the index of the item in the model specified by the given row, column and parent index.
| theRow | a row |
| theColumn | a column |
| theParent | a parent model index |
|
virtual |
Returns the parent of the model item with the given index.
If the item has no parent, an invalid QModelIndex is returned.
| theIndex | a model index |
|
virtual |
Returns true if parent has any children; otherwise returns false.
| theParent | a parent model index |
|
virtual |
Inserts count rows into the model before the given row.
Items in the new row will be children of the item represented by the parent model index.
| theRow | a start row |
| theCount | a nember of rows to insert |
| theParent | a parent model index |
|
virtual |
Removes count rows starting with the given row under parent parent from the model.
| theRow | a start row |
| theCount | a nember of rows to remove |
| theParent | a parent model index |
|
virtual |
Returns the item flags for the given index.
| theIndex | a model index |
|
overridevirtual |
Returns true if a model can accept a drop of the data (used for drag and drop functionality).
|
overridevirtual |
Converts the dragged items information into mime data format (to be encoded in dropMimeData)
|
overridevirtual |
Performs a drag and drop of Part feature operation when it is dropped.
| QModelIndex XGUI_DataModel::documentRootIndex | ( | DocumentPtr | theDoc, |
| int | theColumn = 1 |
||
| ) | const |
Returns an index which is root of the given document.
| theDoc | a document |
| bool XGUI_DataModel::hasHiddenState | ( | const QModelIndex & | theIndex | ) |
Returns true if the data model item has Hidden visual state.
| theIndex | a tree model item |
| bool XGUI_DataModel::hasIndex | ( | const QModelIndex & | theIndex | ) | const |
Returns true if the given index exists in data tree.
| theIndex | an index to check |
| bool XGUI_DataModel::hasNode | ( | ModuleBase_ITreeNode * | theNode | ) | const |
Returns true if the given node is a parto of the data tree.
| theNode | a node to check |
| DocumentPtr XGUI_DataModel::document | ( | const QModelIndex & | theIndex | ) | const |
Returns document of the given index.
| theIndex | an index to check |
| QModelIndex XGUI_DataModel::getIndex | ( | ModuleBase_ITreeNode * | theNode, |
| int | thCol | ||
| ) | const |
Returns index for the node and column.
| theNode | a node |
| thCol | a column |
|
inlineoverridevirtual |
Allows to support drag and drop of some model items.
|
signal |
Signal send before tree rebuild.
|
signal |
Signal about tree had been rebuilt.
|
inlinevirtualinherited |
Listener that needs mostly grouped messages received returns true in this method.
In this case during the message is flushed, all the new messages are grouped, not sended immideately and then sent in the end of flush.
Reimplemented in SketchSolver_Manager, and SketchPlugin_OverConstraintsResolver.
|
protectedinherited |
Allows to group messages while they are flushed (for flush for groupMessages=true listeners)
|
protectedinherited |
Sends myGroups on flush finish.