0031939: Coding - correction of spelling errors in comments [part 2]
[occt.git] / tools / VInspector / VInspector_ItemContextProperties.cxx
1 // Created on: 2020-02-10
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2020 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement. 
15
16 #include <inspector/VInspector_ItemContextProperties.hxx>
17
18 #include <inspector/VInspector_ItemContext.hxx>
19 #include <inspector/VInspector_ItemV3dViewer.hxx>
20 #include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
21
22 // =======================================================================
23 // function : initValue
24 // purpose :
25 // =======================================================================
26 QVariant VInspector_ItemContextProperties::initValue (int theItemRole) const
27 {
28   QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
29   if (aParentValue.isValid())
30     return aParentValue;
31
32   if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole))
33     return QVariant();
34
35   return "Properties";
36 }
37
38 // =======================================================================
39 // function : initRowCount
40 // purpose :
41 // =======================================================================
42 int VInspector_ItemContextProperties::initRowCount() const
43 {
44   return 2; // V3d_Viewer, SelectMgr_ViewerSelector
45 }
46
47 // =======================================================================
48 // function : createChild
49 // purpose :
50 // =======================================================================
51 TreeModel_ItemBasePtr VInspector_ItemContextProperties::createChild (int theRow, int theColumn)
52 {
53   if (theRow == 0)
54     return VInspector_ItemV3dViewer::CreateItem (currentItem(), theRow, theColumn);
55
56   return VInspector_ItemSelectMgrViewerSelector::CreateItem (currentItem(), theRow, theColumn);
57 }
58
59 // =======================================================================
60 // function : initItem
61 // purpose :
62 // =======================================================================
63 void VInspector_ItemContextProperties::initItem() const
64 {
65   if (IsInitialized())
66     return;
67   const_cast<VInspector_ItemContextProperties*> (this)->Init();
68 }