mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0030268: Inspectors - improvements in VInspector plugin
- Convert package creation. It is used to prepare some auxiliary presentations/methods to prepare variables for inspector based on occt classes. - ViewControl package improvement: Classes for property view, table, table model are implemented to visualize view of properties. This view is filled by selection in tree if the selected object has implemented DumpJson functionality. - TreeModel package improvements: Method InitColumn is implemented in TreeModel_TreeModel to fill default columns in base model. The default columns are: Name, Visibility, Rows. Additional columns should be added in successors. Container of root items is moved into the base class - View package imrovements: Store preferences: display mode, fit all checked state and type of external context View_DisplayPreview is added to process preview for selected in tree view objects hide actions Clear, Multi, Single by default (as selection in tree view or Visibility state of item define which presentations should be displayed or erased) - ShapeView plugin improvements: Property View content based on DumpJson (columns in tree view for properties are removed), Properties for TopoDS_Shape are displayed Explode shape action in tree view to see content of shape by selected shape type. Type of displayed shapes is only preview, it is not used in export action. Export shape into BREP. The previous implementation about BREP files in some directory and default view is removed. - VInspector plugin imrovements: Property View content based on DumpJson (columns in tree view for properties are removed), Properties for AIS_InteractiveContext and AIS_InteractiveObject are displayed obsolete classes to provide properties are removed. - DFBrowser plugin improvements: Property View content based on DumpJson is not used yet. But there is the USE_DUMPJSON macro. It's switch off by default. If switch ON, it creates a Property View filled with DumpJson. It's a way of DFBrowser moving on this property view. Init uses static variable CDF_Session::CurrentSession()->CurrentApplication to fill plugin if application in plugin is not set but OCAF application exists - OCC_VERSION_HEX variable used for previous OCCT versions support (before 6.9.0 or 7.2.0) is removed
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#include <inspector/TreeModel_ItemBase.hxx>
|
||||
#include <inspector/TreeModel_HeaderSection.hxx>
|
||||
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QExplicitlySharedDataPointer>
|
||||
@@ -48,6 +50,10 @@ public:
|
||||
//! Destructor
|
||||
virtual ~TreeModel_ModelBase() {}
|
||||
|
||||
//! Creates model columns and root items.
|
||||
//! Default columns are: [0] - Name, [1] - Visibility, [2] - Row
|
||||
Standard_EXPORT virtual void InitColumns();
|
||||
|
||||
//! Returns the item shared pointer by the model index
|
||||
//! if it is in the index internal pointer
|
||||
//! @param theIndex a model index
|
||||
@@ -59,7 +65,7 @@ public:
|
||||
|
||||
//! Returns the model root item.
|
||||
//! It is realized for OCAFBrowser
|
||||
virtual TreeModel_ItemBasePtr RootItem (const int theColumn) const { (void)theColumn; return m_pRootItem; }
|
||||
TreeModel_ItemBasePtr RootItem (const int theColumn) const { return myRootItems[theColumn]; }
|
||||
|
||||
//! Emits the layoutChanged signal from outside of this class
|
||||
Standard_EXPORT void EmitLayoutChanged();
|
||||
@@ -76,14 +82,21 @@ public:
|
||||
//! \param theState state
|
||||
bool IsUseVisibilityColumn() const { return m_pUseVisibilityColumn; }
|
||||
|
||||
//!< Fills visibility state checker
|
||||
//!< \param theController the checker interface
|
||||
//! Fills visibility state checker
|
||||
//! \param theController the checker interface
|
||||
void SetVisibilityState (TreeModel_VisibilityState* theController) { myVisibilityState = theController; }
|
||||
|
||||
//!< Returns visibility state checker
|
||||
//!< \return the checker interface
|
||||
//! Returns visibility state checker
|
||||
//! \return the checker interface
|
||||
TreeModel_VisibilityState* GetVisibilityState () const { return myVisibilityState; }
|
||||
|
||||
//! Returns true if the tree view model contains highlighted items. This highlight is set manually.
|
||||
bool HasHighlighted() { return !myHighlightedIndices.isEmpty(); }
|
||||
|
||||
//! Sets items of the indices highlighted in the model.
|
||||
//! \param theIndices a list of tree model indices
|
||||
void SetHighlighted (const QModelIndexList& theIndices = QModelIndexList()) { myHighlightedIndices = theIndices; }
|
||||
|
||||
//! Returns the index of the item in the model specified by the given row, column and parent index.
|
||||
//! Saves an internal pointer at the createIndex. This pointer is a shared pointer to the class,
|
||||
//! that realizes a base item interface. If the parent is invalid, a root item is used, otherwise a new item
|
||||
@@ -130,11 +143,10 @@ public:
|
||||
//! \return header section values container
|
||||
TreeModel_HeaderSection GetHeaderItem (const int theColumnId) const { return myHeaderValues[theColumnId]; }
|
||||
|
||||
//! Set header properties item.
|
||||
//! Sets header properties item.
|
||||
//! \param theColumnId a column index
|
||||
//! \param theSection a section value
|
||||
void SetHeaderItem (const int theColumnId, const TreeModel_HeaderSection& theSection)
|
||||
{ myHeaderValues[theColumnId] = theSection; createRootItem (theColumnId); }
|
||||
Standard_EXPORT void SetHeaderItem (const int theColumnId, const TreeModel_HeaderSection& theSection);
|
||||
|
||||
//! Returns count of columns in the model
|
||||
//! \param theParent an index of the parent item
|
||||
@@ -146,6 +158,14 @@ public:
|
||||
//! \return integer value
|
||||
static int ColumnVisibilityWidth() { return 20; }
|
||||
|
||||
//! Returns selected items in the cell of given orientation.
|
||||
//! \param theIndices a container of selected indices
|
||||
//! \param theCellId column index if orientation is horizontal, row index otherwise
|
||||
//! \param theOrientation an orientation to apply the cell index
|
||||
//! \return model indices from the list
|
||||
Standard_EXPORT static QModelIndexList Selected (const QModelIndexList& theIndices, const int theCellId,
|
||||
const Qt::Orientation theOrientation = Qt::Horizontal);
|
||||
|
||||
//! Returns single selected item in the cell of given orientation. If the orientation is Horizontal,
|
||||
//! in the cell id colum, one row should be selected.
|
||||
//! \param theIndices a container of selected indices
|
||||
@@ -155,24 +175,38 @@ public:
|
||||
Standard_EXPORT static QModelIndex SingleSelected (const QModelIndexList& theIndices, const int theCellId,
|
||||
const Qt::Orientation theOrientation = Qt::Horizontal);
|
||||
|
||||
//! Returns selected tree model items for indices.
|
||||
//! \param theIndices a container of selected indices
|
||||
//! \return model items from the list
|
||||
Standard_EXPORT static QList<TreeModel_ItemBasePtr> SelectedItems (const QModelIndexList& theIndices);
|
||||
|
||||
protected:
|
||||
//! Creates root item
|
||||
//! \param theColumnId index of a column
|
||||
virtual void createRootItem (const int theColumnId) = 0;
|
||||
virtual TreeModel_ItemBasePtr createRootItem (const int theColumnId) = 0;
|
||||
|
||||
//! Converts the item shared pointer to void* type
|
||||
//! \param theItem
|
||||
//! \return an item pointer
|
||||
Standard_EXPORT static void* getIndexValue (const TreeModel_ItemBasePtr& theItem);
|
||||
|
||||
private:
|
||||
//! Creates root item
|
||||
//! \param theColumnId index of a column
|
||||
Standard_EXPORT void createRoot (const int theColumnId);
|
||||
|
||||
protected:
|
||||
|
||||
TreeModel_ItemBasePtr m_pRootItem; //!< the model root item. It should be created in the
|
||||
QMap<int, TreeModel_ItemBasePtr> myRootItems; //!< container of root items, for each column own root item
|
||||
QMap<int, TreeModel_HeaderSection> myHeaderValues; //!< header values
|
||||
//!< model subclass. The model is fulfilled by this item content
|
||||
|
||||
bool m_pUseVisibilityColumn; //!< the state whether column=0 is reserved for Visibility state
|
||||
TreeModel_VisibilityState* myVisibilityState; //!< the interface of item visibility
|
||||
QIcon myVisibleIcon; //!< icon of visible state
|
||||
QIcon myInvisibleIcon; //!< icon of invisible state
|
||||
|
||||
QModelIndexList myHighlightedIndices; //!< tree model indices that should be visualized as highlighted
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user