1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 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 #include <inspector/DFBrowserPane_TDataStdBooleanArray.hxx>
17 #include <inspector/DFBrowserPane_TableView.hxx>
18 #include <inspector/DFBrowserPane_AttributePaneModel.hxx>
19 #include <inspector/DFBrowserPane_HelperArray.hxx>
21 #include <TDataStd_BooleanArray.hxx>
23 #include <Standard_WarningsDisable.hxx>
24 #include <QGridLayout>
27 #include <Standard_WarningsRestore.hxx>
29 // =======================================================================
30 // function : CreateWidget
32 // =======================================================================
33 QWidget* DFBrowserPane_TDataStdBooleanArray::CreateWidget (QWidget* theParent)
35 QWidget* aMainWidget = new QWidget (theParent);
36 myTableView = new DFBrowserPane_TableView (aMainWidget);
37 myTableView->SetModel (getPaneModel());
39 myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
44 // =======================================================================
47 // =======================================================================
48 void DFBrowserPane_TDataStdBooleanArray::Init (const Handle(TDF_Attribute)& theAttribute)
50 QList<QVariant> aValues;
51 GetValues (theAttribute, aValues);
52 myArrayTableHelper.Init (aValues);
55 // =======================================================================
56 // function : GetValues
58 // =======================================================================
59 void DFBrowserPane_TDataStdBooleanArray::GetValues (const Handle(TDF_Attribute)& theAttribute,
60 QList<QVariant>& theValues)
62 Handle(TDataStd_BooleanArray) anAttribute = Handle(TDataStd_BooleanArray)::DownCast (theAttribute);
63 if (anAttribute.IsNull())
66 theValues.append (anAttribute->Lower());
67 theValues.append (anAttribute->Upper());
68 for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
69 theValues.append (anAttribute->Value (aValueId));
72 // =======================================================================
73 // function : GetShortAttributeInfo
75 // =======================================================================
76 void DFBrowserPane_TDataStdBooleanArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
77 QList<QVariant>& theValues)
79 QList<QVariant> aValues;
80 GetValues (theAttribute, aValues);
81 myArrayTableHelper.Init (aValues);
82 return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);