1 // Copyright (C) 2015-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : HexoticPluginGUI_ViscousLayersWidget.cxx
24 #include "HexoticPluginGUI_Dlg.h"
26 #include <SUIT_Session.h>
27 #include <SUIT_ResourceMgr.h>
29 #include <StdMeshersGUI_SubShapeSelectorWdg.h>
31 //////////////////////////////////////////
32 // HexoticPluginGUI_ViscousLayersWidget
33 //////////////////////////////////////////
35 HexoticPluginGUI_ViscousLayersWidget::HexoticPluginGUI_ViscousLayersWidget( QWidget* parent, Qt::WindowFlags f )
36 : QWidget( parent, f )
40 // Obtain precision from preferences
41 int precision = SUIT_Session::session()->resourceMgr()->integerValue( "SMESH", "length_precision", -3 );
43 myNbLayers->setMinimum(0);
44 myNbLayers->setSingleStep( 1 );
46 myFirstLayerSize->setMinimum(0);
47 myFirstLayerSize->setPrecision(precision);
48 myFirstLayerSize->setSingleStep(0.1);
50 myGrowth->setMinimum(0);
51 myFirstLayerSize->setPrecision(precision);
52 myGrowth->setSingleStep( 0.1 );
54 myFacesWithLayers = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE);
55 QHBoxLayout* layoutFacesWithLayers = new QHBoxLayout(myContainerFacesWithLayers);
56 layoutFacesWithLayers->setMargin(0);
57 layoutFacesWithLayers->addWidget(myFacesWithLayers);
59 myImprintedFaces = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE);
60 QHBoxLayout* layoutImprintedFaces = new QHBoxLayout(myContainerImprintedFaces);
61 layoutImprintedFaces->setMargin(0);
62 layoutImprintedFaces->addWidget(myImprintedFaces);
64 connect( myFacesWithLayers, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
65 connect( myImprintedFaces, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
68 HexoticPluginGUI_ViscousLayersWidget::~HexoticPluginGUI_ViscousLayersWidget()
72 void HexoticPluginGUI_ViscousLayersWidget::onSelectionChanged()
74 StdMeshersGUI_SubShapeSelectorWdg* send = (StdMeshersGUI_SubShapeSelectorWdg*)sender();
76 bool isDefault = (send == myFacesWithLayers);
77 myFacesWithLayers->ShowPreview(isDefault);
78 myImprintedFaces->ShowPreview(!isDefault);
80 myImprintedFaces->ClearSelected();
82 myFacesWithLayers->ClearSelected();