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>
24 #pragma warning(disable : 4127) // conditional expression is constant
27 #include <QGridLayout>
31 // =======================================================================
32 // function : CreateWidget
34 // =======================================================================
35 QWidget* DFBrowserPane_TDataStdBooleanArray::CreateWidget (QWidget* theParent)
37 QWidget* aMainWidget = new QWidget (theParent);
38 myTableView = new DFBrowserPane_TableView (aMainWidget);
39 myTableView->SetModel (getPaneModel());
41 myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
46 // =======================================================================
49 // =======================================================================
50 void DFBrowserPane_TDataStdBooleanArray::Init (const Handle(TDF_Attribute)& theAttribute)
52 QList<QVariant> aValues;
53 GetValues (theAttribute, aValues);
54 myArrayTableHelper.Init (aValues);
57 // =======================================================================
58 // function : GetValues
60 // =======================================================================
61 void DFBrowserPane_TDataStdBooleanArray::GetValues (const Handle(TDF_Attribute)& theAttribute,
62 QList<QVariant>& theValues)
64 Handle(TDataStd_BooleanArray) anAttribute = Handle(TDataStd_BooleanArray)::DownCast (theAttribute);
65 if (anAttribute.IsNull())
68 theValues.append (anAttribute->Lower());
69 theValues.append (anAttribute->Upper());
70 for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
71 theValues.append (anAttribute->Value (aValueId));
74 // =======================================================================
75 // function : GetShortAttributeInfo
77 // =======================================================================
78 void DFBrowserPane_TDataStdBooleanArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
79 QList<QVariant>& theValues)
81 QList<QVariant> aValues;
82 GetValues (theAttribute, aValues);
83 myArrayTableHelper.Init (aValues);
84 return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);