1 // Created on: 2021-04-27
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2021 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef MessageModel_TreeModel_H
17 #define MessageModel_TreeModel_H
19 #include <inspector/MessageModel_ItemBase.hxx>
20 #include <inspector/MessageModel_ItemRoot.hxx>
21 #include <Standard.hxx>
22 #include <TCollection_AsciiString.hxx>
23 #include <Message_Report.hxx>
24 #include <inspector/TreeModel_ModelBase.hxx>
26 #include <Standard_WarningsDisable.hxx>
29 #include <Standard_WarningsRestore.hxx>
31 class MessageModel_TreeModel;
33 //! \class MessageModel_TreeModel
34 //! View model to visualize MessageReport/s content
35 class MessageModel_TreeModel : public TreeModel_ModelBase
40 Standard_EXPORT MessageModel_TreeModel (QObject* theParent);
43 virtual ~MessageModel_TreeModel() Standard_OVERRIDE {};
45 //! Creates model columns and root items.
46 Standard_EXPORT virtual void InitColumns() Standard_OVERRIDE;
48 //!< Returns columns of the model for the metric
49 //!< \param theMetricType metric
50 //!< \param theMetricColumns [out] container of metric columns
51 static Standard_EXPORT void GetMetricColumns (const Message_MetricType theMetricType, QList<int>& theMetricColumns);
53 //!< Returns metric type for the column
54 //!< \param theColumnId [in] index of the tree column
55 //!< \param theMetricType [out] metric type if found
56 //!< \param thePosition [out] index of the metric column, 0 - is metric, 1 - is delta
57 //!< \return true if the column has metric parameters
58 static Standard_EXPORT bool IsMetricColumn (const int theColumnId, Message_MetricType& theMetricType, int& thePosition);
60 //! Returns true if parameter report was added into the model
61 //! \param theReport a report instance
62 //! \return boolen value
63 Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
65 //! Add shape, append it to the model root item
66 //! \param theReport a report instance
67 //! \param theReportDescription an additional report information
68 Standard_EXPORT void AddReport (const Handle(Message_Report)& theReport,
69 const TCollection_AsciiString& theReportDescription = "");
71 //! Set report, se it into the given row index
72 //! \param theRowId a report child row
73 //! \param theReport a report instance
74 //! \param theReportDescription an additional report information
75 Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
76 const TCollection_AsciiString& theReportDescription = "");
78 //!< Returns processed reports
79 Standard_EXPORT const NCollection_List<MessageModel_ReportInformation>& Reports() const;
81 //! Sets the text value of the Root item, only "Name" column accepts the parameter value
82 //! \theName visulized text of root item
83 Standard_EXPORT void SetRootItemName (const TCollection_AsciiString& theName);
85 //! Updates tree model
86 Standard_EXPORT void UpdateTreeModel();
90 //! \param theColumnId index of a column
91 virtual TreeModel_ItemBasePtr createRootItem (const int theColumnId) Standard_OVERRIDE;